[内核版本:linux-2.6.30]
Linux网络系统调用接口其定义在:linux/net/socket.c
其中主要的接口,如下所示。
1. socket
Function:
Definition: SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
Process: socket_create --> __socket_create --> sock_alloc --> 回调(pf->create) --> socket_map_fd
其中对应的pf->create对应的协议不同,其操作函数不用。
==> AF_INET = PF_INET ==> inet_create (net/ipv4/af_inet.c)
==>
2. bind
Fuction: Bind a name to a socket.
Definition: SYSCALL_DEFINE3(bind, int, fd, struct sockaddr __user *, umyaddr, int, addrlen)
3. listen
Function:
Definition: SYSCALL_DEFINE2(listen, int, fd, int, backlog)
4. acceptFunction:
Definition: SYSCALL_DEFINE3(accept, int, fd, struct sockaddr __user *, upeer_sockaddr, int __user *, upeer_addrlen)