Linux System Call Table(2.2)
%eax Name Source %ebx %ecx %edx %esx %edi 1 int - - - - 2 - - - - 3 unsigned int char * - - 4 unsigned int const char * - - 5 const char * int int - - 6 unsigned int - - - - 7 pid_t unsigned int * int - - 8 const char * int - - - 9 const char * const char * - - - 10 const char * - - - - 11 - - - - 12 const char * - - - - 13 int * - - - - 14 const char * int - - 15 const char * - - - 16 const char * - - 18 char * - - - 19 unsigned int unsigned int - - 20 - - - - - 21 char * char * char * - - 22 sys_oldumount char * - - - - 23 - - - - 24 - - - - - 25 int * - - - - 26 long long long long - 27 unsigned int - - - - 28 unsigned int - - - 29 - - - - - 30 char * - - - 33 const char * int - - - 34 int - - - - 36 - - - - - 37 int int - - - 38 const char * const char * - - - 39 const char * int - - - 40 const char * - - - - 41 unsigned int - - - - 42 unsigned long * - - - - 43 - - - - 45 unsigned long - - - - 46 - - - - 47 - - - - - 48 int - - - 49 - - - - - 50 - - - - - 51 const char * - - - - 52 char * int - - - 54 unsigned int unsigned int unsigned long - - 55 unsigned int unsigned int unsigned long - - 57 - - - 59 - - - - 60 int - - - - 61 const char * - - - - 62 - - - 63 unsigned int unsigned int - - - 64 - - - - - 65 - - - - - 66 - - - - - 67 int const - - 68 - - - - - 69 int - - - - 70 - - - 71 - - - 72 int int - - 73 - - - - 74 char * int - - - 75 unsigned int - - - 76 unsigned int - - - 77 int - - - 78 - - - 79 - - - 80 int - - - 81 int - - - 82 old_select - - - - 83 const char * const char * - - - 84 char * - - - 85 const char * char * int - - 86 const char * - - - - 87 const char * int - - - 88 int int int void * - 89 old_readdir unsigned int void * unsigned int - - 90 old_mmap - - - - 91 unsigned long - - - 92 const char * unsigned long - - - 93 unsigned int unsigned long - - - 94 unsigned int - - - 95 unsigned int - - 96 int int - - - 97 int int int - - 99 const char * - - - 100 unsigned int - - - 101 unsigned long unsigned long int - - 102 int unsigned long * - - - 103 int char * int - - 104 int - - 105 int - - - 106 sys_newstat char * - - - 107 sys_newlstat char * - - - 108 sys_newfstat unsigned int - - - 109 - - - - 110 unsigned long - - - - 111 - - - - - 112 - - - - - 113 unsigned long - - - 114 unsigned long * int options - 115 const char * - - - - 116 - - - - 117 sys_ipc int int int void * 118 unsigned int - - - - 119 unsigned long - - - - 120 - - - - 121 char * int - - - 122 sys_newuname - - - - 123 int void * unsigned long - - 124 - - - - 125 unsigned long unsigned long - - 126 int - - 127 const char * - - - 128 const char * - - - 129 const char * - - - - 130 - - - - 131 int const char * int - 132 - - - - 133 unsigned int - - - - 134 int long - - - 135 int unsigned long unsigned long - - 136 unsigned long - - - - 138 - - - - 139 - - - - 140 unsigned int unsigned long unsigned long unsigned int 141 unsigned int void * unsigned int - - 142 int 143 unsigned int unsigned int - - - 144 unsigned long int - - 145 unsigned long unsigned long - - 146 unsigned long unsigned long - - 147 - - - - 148 unsigned int - - - - 149 - - - - 150 unsigned long - - - 151 unsigned long - - - 152 int - - - - 153 - - - - - 154 - - - 155 - - - 156 int - - 157 - - - - 158 - - - - - 159 int - - - - 160 int - - - - 161 - - - 162 - - - 163 unsigned long unsigned long unsigned long unsigned long - 164 - - 165 - - 166 - - - - 167 const char * int char * 168 unsigned int long - - 169 int void * void * - - 170 - - 171 - - 172 int unsigned long unsigned long unsigned long unsigned long 173 sys_rt_sigreturn unsigned long - - - - 174 sys_rt_sigaction int - 175 sys_rt_sigprocmask int - 176 sys_rt_sigpending - - - 177 sys_rt_sigtimedwait - 178 sys_rt_sigqueueinfo int int - - 179 sys_rt_sigsuspend - - - 180 unsigned int char * - 181 unsigned int const char * - 182 const char * - - 183 sys_getcwd char * unsigned long - - - 184 - - - 185 - - - 186 - - - 187 int int - 190 - - - -
Note for sys_ipc (117): this syscall takes six arguments, so it can't fit into the five registers %ebx - %edi; the last parameter (not shown) is of type 'long'. This syscall requires a special call method where a pointer is put in %ebx which points to an array containing the six arguments.
System Call Numbers
For the numbers of the syscalls, look in for sys_call_table. The syscall numbers are offsets into that table. Several spots in the table are occupied by the syscallsys_ni_syscall. This is a placeholder that either replaces an obsolete syscall or reserves a spot for future syscalls.
Incidentally, the system calls are called from the function system_call in the same file; in particular, they are called with the assembly instruction 'call *SYMBOL_NAME(sys_call_table)(,%eax,4)'. The part '*SYMBOL_NAME(sys_call_table)' just gets replaced by a symbol name in sys_call_table. SYMBOL_NAME is a macro defined in , and it just replaces itself with its argument.
Typedefs
Here are the typedef declarations in the prototypes above:
atomic_t | :#ifdef __SMP__typedef struct { volatile int counter; } atomic_t;#elsetypedef struct { int counter; } atomic_t;#endif |
---|---|
caddr_t | :typedef char * __kernel_caddr_t;:typedef __kernel_caddr_t caddr_t; |
cap_user_header_t | :typedef struct __user_cap_header_struct { version; int pid;} *cap_user_header_t; |
cap_user_data_t | :typedef struct __user_cap_data_struct { effective; permitted; inheritable;} *cap_user_data_t; |
clock_t | :typedef long __kernel_clock_t;:typedef __kernel_clock_t clock_t; |
dev_t | :typedef unsigned short __kernel_dev_t;:typedef __kernel_dev_t dev_t; |
fd_set | include/linux/posix_types.h#define __FD_SETSIZE 1024#define __NFDBITS (8 * sizeof(unsigned long))#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS)(==> __FDSET_LONGS == 32)typedef struct { unsigned long fds_bits [__FDSET_LONGS];} __kernel_fd_set;:typedef __kernel_fd_set fd_set; |
gid_t | :typedef unsigned short __kernel_gid_t;:typedef __kernel_gid_t gid_t; |
__kernel_daddr_t | :typedef int __kernel_daddr_t; |
__kernel_fsid_t | :typedef struct { int __val[2];} __kernel_fsid_t; |
__kernel_ino_t | :typedef unsigned long __kernel_ino_t; |
__kernel_size_t | :typedef unsigned int __kernel_size_t; |
loff_t | :typedef long long __kernel_loff_t;:typedef __kernel_loff_t loff_t; |
mode_t | :typedef unsigned short __kernel_mode_t;:typedef __kernel_mode_t mode_t; |
off_t | :typedef long __kernel_off_t; :typedef __kernel_off_t off_t; |
old_sigset_t | :typedef unsigned long old_sigset_t; |
pid_t | :typedef int __kernel_pid_t;:typedef __kernel_pid_t pid_t; |
__sighandler_t | :typedef void (*__sighandler_t)(int); |
siginfo_t | :#define SI_MAX_SIZE 128#define SI_PAD_SIZE ((SI_MAX_SIZE/sizeof(int)) - 3)(==> SI_PAD_SIZE == 29)typedef struct siginfo { int si_signo; int si_errno; int si_code; union { int _pad[SI_PAD_SIZE]; /* kill() */ struct { _pid; /* sender's pid */ _uid; /* sender's uid */ } _kill; /* POSIX.1b timers */ struct { unsigned int _timer1; unsigned int _timer2; } _timer; /* POSIX.1b signals */ struct { _pid; /* sender's pid */ _uid; /* sender's uid */ sigval_t _sigval; } _rt; /* SIGCHLD */ struct { _pid; /* which child */ _uid; /* sender's uid */ int _status; /* exit code */ _utime; _stime; } _sigchld; /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */ struct { void *_addr; /* faulting insn/memory ref. */ } _sigfault; /* SIGPOLL */ struct { int _band; /* POLL_IN, POLL_OUT, POLL_MSG */ int _fd; } _sigpoll; } _sifields;} siginfo_t; |
sigset_t | :typedef unsigned long sigset_t; |
size_t | :typedef unsigned int __kernel_size_t;:typedef __kernel_size_t size_t; |
ssize_t | :typedef int __kernel_ssize_t;:typedef __kernel_ssize_t ssize_t; |
stack_t | :typedef struct sigaltstack { void *ss_sp; int ss_flags; ss_size;} stack_t; |
suseconds_t | :typedef long __kernel_suseconds_t;:typedef __kernel_suseconds_t suseconds_t; |
time_t | :typedef long __kernel_time_t;:typedef __kernel_time_t time_t; |
uid_t | :typedef unsigned short __kernel_uid_t;:typedef __kernel_uid_t uid_t; |
uint | :typedef unsigned int uint; |
__u32 | :typedef unsigned int __u32; |
Structs
Here are the struct declarations for the table at the top:
exception_table_entry | :struct exception_table_entry { unsigned long insn, fixup;}; |
---|---|
iovec | :struct iovec { void *iov_base; iov_len; }; |
itimerval | :struct itimerval { it_interval; /* timer interval */ it_value; /* current value */}; |
kernel_sym | :struct kernel_sym { unsigned long value; char name[60];}; |
mmap_arg_struct | :struct mmap_arg_struct { unsigned long addr; unsigned long len; unsigned long prot; unsigned long flags; unsigned long fd; unsigned long offset;}; |
module | :struct module { unsigned long size_of_struct; /* sizeof(module) */ *next; const char *name; unsigned long size; union { usecount; long pad; } uc; unsigned long flags; /* AUTOCLEAN et al */ unsigned nsyms; unsigned ndeps; *syms; *deps; *refs; int (*init)(void); void (*cleanup)(void); const *ex_table_start; const *ex_table_end;/* Members past this point are extensions to the basicmodule support and are optional. Use mod_opt_member()to examine them. */ const *persist_start; const *persist_end; int (*can_unload)(void);}; |
module_persist | :struct module_persist; /* yes, it's empty */ |
module_ref | :struct module_ref { *dep; /* "parent" pointer */ *ref; /* "child" pointer */ *next_ref;}; |
module_symbol | :struct module_symbol { unsigned long value; const char *name;}; |
new_utsname | :struct new_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65]; char domainname[65];}; |
__old_kernel_stat | :struct __old_kernel_stat { unsigned short st_dev; unsigned short st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; unsigned long st_size; unsigned long st_atime; unsigned long st_mtime; unsigned long st_ctime;}; |
oldold_utsname | :struct oldold_utsname { char sysname[9]; char nodename[9]; char release[9]; char version[9]; char machine[9];}; |
old_sigaction | :struct old_sigaction { sa_handler; sa_mask; unsigned long sa_flags; void (*sa_restorer)(void);}; |
old_utsname | :struct old_utsname { char sysname[65]; char nodename[65]; char release[65]; char version[65]; char machine[65];}; |
pollfd | :struct pollfd { int fd; short events; short revents;}; |
pt_regs | :struct pt_regs { long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; int xds; int xes; long orig_eax; long eip; int xcs; long eflags; long esp; int xss;}; |
revectored_struct | :struct revectored_struct { unsigned long __map[8];}; |
rlimit | :struct rlimit { long rlim_cur; long rlim_max;}; |
rusage | :struct rusage { ru_utime; /* user time used */ ru_stime; /* system time used */ long ru_maxrss; /* maximum resident set size */ long ru_ixrss; /* integral shared memory size */ long ru_idrss; /* integral unshared data size */ long ru_isrss; /* integral unshared stack size */ long ru_minflt; /* page reclaims */ long ru_majflt; /* page faults */ long ru_nswap; /* swaps */ long ru_inblock; /* block input operations */ long ru_oublock; /* block output operations */ long ru_msgsnd; /* messages sent */ long ru_msgrcv; /* messages received */ long ru_nsignals; /* signals received */ long ru_nvcsw; /* voluntary context switches */ long ru_nivcsw; /* involuntary '' */}; |
sched_param | :struct sched_param { int sched_priority;}; |
sel_arg_struct | :struct sel_arg_struct { unsigned long n; *inp, *outp, *exp; *tvp;}; |
sigaction | :struct sigaction { sa_handler; unsigned long sa_flags; void (*sa_restorer)(void); sa_mask; /* mask last for extensibility */}; |
stat | :struct stat { unsigned short st_dev; unsigned short __pad1; unsigned long st_ino; unsigned short st_mode; unsigned short st_nlink; unsigned short st_uid; unsigned short st_gid; unsigned short st_rdev; unsigned short __pad2; unsigned long st_size; unsigned long st_blksize; unsigned long st_blocks; unsigned long st_atime; unsigned long __unused1; unsigned long st_mtime; unsigned long __unused2; unsigned long st_ctime; unsigned long __unused3; unsigned long __unused4; unsigned long __unused5; |
statfs | :struct statfs { long f_type; long f_bsize; long f_blocks; long f_bfree; long f_bavail; long f_files; long f_ffree; f_fsid; long f_namelen; long f_spare[6];}; |
__sysctl_args | include/linux/sysctl.hstruct __sysctl_args { int *name; int nlen; void *oldval; *oldlenp; void *newval; newlen; unsigned long __unused[4];}; |
sysinfo | :struct sysinfo { long uptime; /* Seconds since boot */ unsigned long loads[3]; /* 1, 5, and 15 minute load averages */ unsigned long totalram; /* Total usable main memory size */ unsigned long freeram; /* Available memory size */ unsigned long sharedram; /* Amount of shared memory */ unsigned long bufferram; /* Memory used by buffers */ unsigned long totalswap; /* Total swap space size */ unsigned long freeswap; /* swap space still available */ unsigned short procs; /* Number of current processes */ char _f[22]; /* Pads structure to 64 bytes */}; |
timex | :struct timex { unsigned int modes; /* mode selector */ long offset; /* time offset (usec) */ long freq; /* frequency offset (scaled ppm) */ long maxerror; /* maximum error (usec) */ long esterror; /* estimated error (usec) */ int status; /* clock command/status */ long constant; /* pll time constant */ long precision; /* clock precision (usec) (read only) */ long tolerance; /* clock frequency tolerance (ppm) * (read only) */ time; /* (read only) */ long tick; /* (modified) usecs between clock ticks */ long ppsfreq; /* pps frequency (scaled ppm) (ro) */ long jitter; /* pps jitter (us) (ro) */ int shift; /* interval duration (s) (shift) (ro) */ long stabil; /* pps stability (scaled ppm) (ro) */ long jitcnt; /* jitter limit exceeded (ro) */ long calcnt; /* calibration intervals (ro) */ long errcnt; /* calibration errors (ro) */ long stbcnt; /* stability limit exceeded (ro) */ int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32; int :32;}; |
timespec | :struct timespec { tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */}; |
timeval | :struct timeval { tv_sec; /* seconds */ tv_usec; /* microseconds */}; |
timezone | :struct timezone { int tz_minuteswest; /* minutes west of Greenwich */ int tz_dsttime; /* type of dst correction */}; |
tms | include/linux/times.hstruct tms { tms_utime; tms_stime; tms_cutime; tms_cstime;}; |
ustat | :struct ustat { f_tfree; f_tinode; char f_fname[6]; char f_fpack[6];}; |
utimbuf | :struct utimbuf { actime; modtime;}; |
vm86plus_info_struct | :struct vm86plus_info_struct { unsigned long force_return_for_pic:1; unsigned long vm86dbg_active:1; unsigned long vm86dbg_TFpendig:1; unsigned long unused:28; unsigned long is_vm86pus:1; unsigned char vm86dbg_intxxtab[32];}; |
vm86plus_struct | :struct vm86plus_struct { regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; int_revectored; int21_revectored; vm86plus;}; |
vm86_regs | :struct vm86_regs { /* normal regs, with special meaning for the segment descriptors.. */ long ebx; long ecx; long edx; long esi; long edi; long ebp; long eax; long __null_ds; long __null_es; long __null_fs; long __null_gs; long orig_eax; long eip; unsigned short cs, __csh; long eflags; long esp; unsigned short ss, __ssh;/* these are specific to v86 mode: */ unsigned short es, __esh; unsigned short ds, __dsh; unsigned short fs, __fsh; unsigned short gs, __gsh;}; |
vm86_struct | :struct vm86_struct { regs; unsigned long flags; unsigned long screen_bitmap; unsigned long cpu_type; int_revectored; int21_revectored;}; |