在include/linux/syscalls.h中有如下宏:
SYSCALL_DEFINE1
如
SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
展开就是sys_open的原型
asmlinkage long sys_open(const char __user *filename,
int flags, int mode);
整个代码:
SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
{
long ret;
if (force_o_largefile())
flags |= O_LARGEFILE;
ret = do_sys_open(AT_FDCWD, filename, flags, mode);
/* avoid REGPARM breakage on x86: */
asmlinkage_protect(3, ret, filename, flags, mode);
return ret;
}
系统调用有几个参数就使用对应的SYSCALL_DEFINEx。
阅读(1042) | 评论(1) | 转发(0) |