日期:2014-05-16 浏览次数:20981 次
#define __SYSCALL_I386(nr, sym, compat) [nr] = sym, typedef asmlinkage void (*sys_call_ptr_t)(void); extern asmlinkage void sys_ni_syscall(void); __visible const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = { /* * Smells like a compiler bug -- it doesn't work * when the & below is removed. */ [0 ... __NR_syscall_max] = &sys_ni_syscall, #include <asm/syscalls_32.h> };其中sys_call_table数组的初始化使用GCC的扩展语法,语句[0 ... __NR_syscall_max] = &sys_ni_syscall将数组内容全部初始化为未实现版本,然后包含asm/syscalls_32.h当中逐项初始化的内容进行初始化。
__SYSCALL_I386(0, sys_restart_syscall, sys_restart_syscall) __SYSCALL_I386(1, sys_exit, sys_exit) __SYSCALL_I386(2, sys_fork, stub32_fork) __SYSCALL_I386(3, sys_read, sys_read) __SYSCALL_I386(4, sys_write, sys_write) __SYSCALL_I386(5, sys_open, compat_sys_open) __SYSCALL_I386(6, sys_close, sys_close) __SYSCALL_I386(7, sys_waitpid, sys32_waitpid) __SYSCALL_I386(8, sys_creat, sys_creat) __SYSCALL_I386(9, sys_link, sys_link) __SYSCALL_I386(10, sys_unlink, sys_unlink) __SYSCALL_I386(11, sys_execve, stub32_execve) __SYSCALL_I386(12, sys_chdir, sys_chdir) __SYSCALL_I386(13, sys_time, compat_sys_time) __SYSCALL_I386(14, sys_mknod, sys_mknod) __SYSCALL_I386(15, sys_chmod, sys_chmod) __SYSCALL_I386(16, sys_lchown16, sys_lchown16) __SYSCALL_I386(18, sys_stat, sys_stat) __SYSCALL_I386(19, sys_lseek, compat_sys_lseek) __SYSCALL_I386(20, sys_getpid, sys_getpid) __SYSCALL_I386(21, sys_mount, compat_sys_mount) __SYSCALL_I386(22, sys_oldumount, sys_oldumount) __SYSCALL_I386(23, sys_setuid16, sys_setuid16) __SYSCALL_I386(24, sys_getuid16, sys_getuid16) __SYSCALL_I386(25, sys_stime, compat_sys_stime) __SYSCALL_I386(26, sys_ptrace, compat_sys_ptrace) __SYSCALL_I386(27, sys_alarm, sys_alarm) __SYSCALL_I386(28, sys_fstat, sys_fstat) __SYSCALL_I386(29, sys_pause, sys_p