我看到很多人在线参考
arch/x86/entry/syscalls/syscall_64.tbl
对于syscall表,效果很好。但很多其他参考
/include/uapi/asm-generic/unistd.h
通常在标头包中找到。怎么syscall_64.tbl
显示
0 common read sys_read
正确的答案并unistd.h
显示出来,
#define __NR_io_setup 0
__SC_COMP(__NR_io_setup, sys_io_setup, compat_sys_io_setup)
然后显示__NR_read
为
#define __NR_read 63
__SYSCALL(__NR_read, sys_read)
为什么是63,而不是1?我如何摆脱困境/include/uapi/asm-generic/unistd.h
?仍然在/usr/include/asm/
那里
/usr/include/asm/unistd_x32.h
#define __NR_read (__X32_SYSCALL_BIT + 0)
#define __NR_write (__X32_SYSCALL_BIT + 1)
#define __NR_open (__X32_SYSCALL_BIT + 2)
#define __NR_close (__X32_SYSCALL_BIT + 3)
#define __NR_stat (__X32_SYSCALL_BIT + 4)
/usr/include/asm/unistd_64.h
#define __NR_read 0
#define __NR_write 1
#define __NR_open 2
#define __NR_close 3
#define __NR_stat 4
/usr/include/asm/unistd_32.h
#define __NR_restart_syscall 0
#define __NR_exit 1
#define __NR_fork 2
#define __NR_read 3
#define __NR_write 4
有人可以告诉我这些unistd
文件之间的区别。解释如何unistd.h
运作?寻找系统调用表的最佳方法是什么?