Summary
System call socket
will do two things:
- create a
struct socket *sock
.
Mainly done by__sock_create
, which alloc astruct socket *sock
,
then init it with thecreating
method ofnet_families[family]
. - map the
sock
to a file descriptor bysock_map_fd
.
TODO…..
call trace:
1 | > socket |
For AF_INET
socket pf->create
is inet_create
,
which will be duscussed here.
1 | 1368 SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) |
socket_create
and __sock_create
1 | 1356 int sock_create(int family, int type, int protocol, struct socket **res) |
1 | 1243 int __sock_create(struct net *net, int family, int type, int protocol, |
What is pf->create
? for PF_INET
family please see here.
####
1 | 528 /** |