来源:
SYSCALL_DEFINE3 在何处定义?
#define SYSCALL_DEFINE3(name, ...)
SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
#define SYSCALL_DEFINEx(x, sname, ...) /
__SYSCALL_DEFINEx(x, sname, __VA_ARGS__)
#define __SYSCALL_DEFINEx(x, name, ...) /
asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
#define (, , ...) /
long ##name(__SC_DECL##x(__VA_ARGS__))
#define (, , ...) , (__VA_ARGS__)
所以对函数定义 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) 就等于
SYSCALL_DEFINEx(3, _##socket, __VA_ARGS__)
= asmlinkage long sys_socket(__SC_DECL3(__VA_ARGS__))
= asmlinkage long sys_socket(int family, __SC_DECL2(__VA_ARGS__))
最终得到
asmlinkage long sys_socket(int family, int type, int protocol)