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*"
)
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With