Nytro Posted August 30, 2012 Report Posted August 30, 2012 LINUX System Call Quick ReferenceIntroductionSystem call is the services provided by Linux kernel. In C programming, it often uses functions defined in libcwhich provides a wrapper for many system calls. Manual page section 2 provides more information aboutsystem calls. To get an overview, use “man 2 intro” in a command shell.It is also possible to invoke syscall() function directly. Each system call has a function number defined in<syscall.h> or <unistd.h>. Internally, system call is invokded by software interrupt 0x80 to transfer control tothe kernel. System call table is defined in Linux kernel source file “arch/i386/kernel/entry.S ”.System Call Example#include <syscall.h>#include <unistd.h>#include <stdio.h>#include <sys/types.h>int main(void) {long ID1, ID2;/*-----------------------------*//* direct system call *//* SYS_getpid (func no. is 20) *//*-----------------------------*/ID1 = syscall(SYS_getpid);printf ("syscall(SYS_getpid)=%ld\n", ID1);/*-----------------------------*//* "libc" wrapped system call *//* SYS_getpid (Func No. is 20) *//*-----------------------------*/ID2 = getpid();printf ("getpid()=%ld\n", ID2);return(0);}http://www.digilife.be/quickreferences/qrc/linux%20system%20call%20quick%20reference.pdf Quote