Sponsored Content
Full Discussion: System call source code
Top Forums Programming System call source code Post 302191807 by era on Monday 5th of May 2008 04:00:54 AM
Old 05-05-2008
System calls, by definition, are part of the operating system. If the source code for your operatnig system is available, you can download and browse it. Similarly for the C library, you can download the source for e.g. GNU glibc.

For more tutorial expositions, in addition to Lions, there's the BSD devil books (different books for 4.3BSD and 4.4BSD) and a book by Plauger about the standard C library. Quick googling also brought up The Linux Kernel: The Book
 

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to differentiate system call from library call

Hi, Ho do I differentiate system call from library call? for example if I am using chmod , how do I find out if it is a system call or library call? Thanks Muru (2 Replies)
Discussion started by: muru
2 Replies

2. Programming

c system call

How the c compiler differentiates the system calls and function calls? (1 Reply)
Discussion started by: rangaswamy
1 Replies

3. UNIX for Dummies Questions & Answers

System call code - nice()

Hi there, i'm trying to find the implementation code for the system call nice(). Since it's a system call i'm having problems finding where it would be? is it in the linux kernel directory somewhere? I would assume it would be a file called nice.c or something like this. Thanks in advance! (2 Replies)
Discussion started by: sport23
2 Replies

4. Programming

system call

I have a cgi script which is called after certain time interval, which has this: system ("ls -l /tmp/cgic* | grep -v \"cgicsave.env\" | awk '{print $5}'"); During the execution of this script,the output is 0 sometimes. But due to this the system call is not working at all and doesnt o/p... (2 Replies)
Discussion started by: xs2punit
2 Replies

5. Programming

need help with system call

hi everyone i wrote a system call and compiled the kernel succesfully... my system call is in a file in the kernel folder named my_syscall1.c (kernel/my_syscall1.c) the header file for this system call i added it in the folder include like this include/my_syscall1/my_syscall1.h my problem is... (2 Replies)
Discussion started by: demis87
2 Replies

6. Shell Programming and Scripting

system call

Trying to figure out a load issue with a webserver. I have traced a php script and noticed the following connect(4, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("XX.XX.XX.XX")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000035> poll(, 1, 2000) = 1 () <0.000120>... (5 Replies)
Discussion started by: rajan007
5 Replies

7. Shell Programming and Scripting

UNIX/Perl script to call informatica source counts

Hi Guys, I am trying below condition . We are using Informatica 9.5 and scheduling certain informatica mapping on set timings .But we are not sure whether the database source table are latest or not .Since its gets updated on daily basis and not sure when it completes.Can we write any unix/perl... (1 Reply)
Discussion started by: Perlbaby
1 Replies
_SYSCALL(2)						     Linux Programmer's Manual						       _SYSCALL(2)

NAME
_syscall - invoking a system call without library support (OBSOLETE) SYNOPSIS
#include <linux/unistd.h> A _syscall macro desired system call DESCRIPTION
The important thing to know about a system call is its prototype. You need to know how many arguments, their types, and the function return type. There are seven macros that make the actual call into the system easier. They have the form: _syscallX(type,name,type1,arg1,type2,arg2,...) where X is 0-6, which are the number of arguments taken by the system call type is the return type of the system call name is the name of the system call typeN is the Nth argument's type argN is the name of the Nth argument These macros create a function called name with the arguments you specify. Once you include the _syscall() in your source file, you call the system call by name. FILES
/usr/include/linux/unistd.h CONFORMING TO
The use of these macros is Linux-specific, and deprecated. NOTES
Starting around kernel 2.6.18, the _syscall macros were removed from header files supplied to user space. Use syscall(2) instead. (Some architectures, notably ia64, never provided the _syscall macros; on those architectures, syscall(2) was always required.) The _syscall() macros do not produce a prototype. You may have to create one, especially for C++ users. System calls are not required to return only positive or negative error codes. You need to read the source to be sure how it will return errors. Usually, it is the negative of a standard error code, for example, -EPERM. The _syscall() macros will return the result r of the system call when r is nonnegative, but will return -1 and set the variable errno to -r when r is negative. For the error codes, see errno(3). When defining a system call, the argument types must be passed by-value or by-pointer (for aggregates like structs). EXAMPLE
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <linux/unistd.h> /* for _syscallX macros/related stuff */ #include <linux/kernel.h> /* for struct sysinfo */ _syscall1(int, sysinfo, struct sysinfo *, info); /* Note: if you copy directly from the nroff source, remember to REMOVE the extra backslashes in the printf statement. */ int main(void) { struct sysinfo s_info; int error; error = sysinfo(&s_info); printf("code error = %d ", error); printf("Uptime = %lds Load: 1 min %lu / 5 min %lu / 15 min %lu " "RAM: total %lu / free %lu / shared %lu " "Memory in buffers = %lu Swap: total %lu / free %lu " "Number of processes = %d ", s_info.uptime, s_info.loads[0], s_info.loads[1], s_info.loads[2], s_info.totalram, s_info.freeram, s_info.sharedram, s_info.bufferram, s_info.totalswap, s_info.freeswap, s_info.procs); exit(EXIT_SUCCESS); } Sample output code error = 0 uptime = 502034s Load: 1 min 13376 / 5 min 5504 / 15 min 1152 RAM: total 15343616 / free 827392 / shared 8237056 Memory in buffers = 5066752 Swap: total 27881472 / free 24698880 Number of processes = 40 SEE ALSO
intro(2), syscall(2), errno(3) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2007-12-19 _SYSCALL(2)
All times are GMT -4. The time now is 06:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy