Reputation: 4820
In C programs, in order to use sockets, we need to include:
#include<sys/socket.h>
I have searched for the socket.c
file (the implementation of <sys/socket.h>
) but didn't found it (find -iname "socket.c*"
)
Upvotes: 11
Views: 6169
Reputation: 6994
socket()
implementation is in net/socket.c
in the linux kernel sources
SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol)
You can modify this file an the implementation.
Upvotes: 3
Reputation: 3580
The header file contains declarations for socket-related system calls. To start diving into the implementation, please consider referring to net/socket.c
file in the Linux source tree.
Regarding changing the implementation - Linux is an open-source software product distributed under the terms of GNU GPL. If you'll spend quite some time to understand how to re-build the kernel from scratch, you'll be able to apply any changes you want to the kernel and deploy it to your local machines (at your own risk of course).
Upvotes: 12