systemcall头文件宏值定义

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaoyilong2007101095/article/details/83893495
long syscall(long number, ...);

syscall的第一个参数number根据例子程序都是使用SYS_*,哪里定义的呢?

根据man 2 syscall可以看到number是使用的 #include <sys/syscall.h>头文件,

里面又#include <asm/unistd.h>  和  # include <bits/syscall.h>

其中asm/unistd.h里面根据平台不同最终引入了asm/unistd_*.h头文件

里面定义了__NR_*

bits/syscall.h里面又根据__NR_* define了SYS_*

所以最终可以使用SYS_*

具体的名字都是有规则的,根据系统调用名字加速SYS组成,可以自行搜索。

猜你喜欢

转载自blog.csdn.net/xiaoyilong2007101095/article/details/83893495
今日推荐