Location of socket() function implementation in linux

linux, sockets

Solution

Acutally, `int socket (int __domain, int __type, int __protocol) __THROW`

implemented in glibc,

and the glibc calls the kernel function sys_socket implemented in kernel file net/socket.c.

asmlinkage long sys_socket(int family, int type, int protocol);

Problem

In Linux, to create a socket we include the sys/socket.h header file and use the socket() function. The header file is located at /usr/include/sys/socket.h. ``` extern int socket (int __domain, int __type, int __protocol) __THROW; ``` Can anyone please tell the location where the socket() function is actually implemented. Thanks.

Original source