__sock_create(9)
πΈ NAME πΈ
__sock_create β creates a socket. Thatβs the whole vibe, bestie: it creates a socket, no cap. π This is the __sock_create(9) page from the Kernel API Manual, and itβs lowkey a main character in kernel socket land.
π¦ SYNOPSIS π¦
int __sock_create (struct net *net , int family , int type , int
protocol , struct socket **res , int kern );
π ARGUMENTS π
netβ net namespace. The namespace bestie in question. πfamilyβ protocol family (AF_INET, ...). This is the family energy. π―typeβ communication type (SOCK_STREAM, ...). The communication style, iykyk. π¬protocolβ protocol (0, ...). The protocol vibe. π‘resβ new socket. This is where the shiny new socket gets assigned. β¨kernβ boolean for kernel space sockets. Kernel-space or not, thatβs the question. π
π DESCRIPTION π
So hereβs the tea, bestie: this function creates a new socket and assigns it to res, passing through LSM. It returns 0 or an error. On failure, res is set to NULL β dramatic, but important. π
kern must be set to true if the socket resides in kernel space. And internally, this function uses GFP_KERNEL. Thatβs literally the allocation flex. π
bestie, do not forget: on failureresis set toNULL. Thatβs not a drill. π«Ά
π SEE ALSO π
Kernel file ./net/socket.c is the group chat, and the whole friend group is right here:
move_addr_to_kernel(9)move_addr_to_user(9)sock_read_xattr(9)sock_alloc_file(9)sock_from_file(9)sockfd_lookup(9)sock_alloc(9)sock_release(9)sock_sendmsg(9)kernel_sendmsg(9)sock_recvmsg(9)kernel_recvmsg(9)sock_create_lite(9)sock_create(9)sock_create_kern(9)sock_register(9)sock_unregister(9)kernel_bind(9)kernel_listen(9)kernel_accept(9)kernel_connect(9)kernel_getsockname(9)kernel_getpeername(9)kernel_sock_shutdown(9)kernel_sock_ip_overhead(9)
slay, you made it to the end π«Ά this page is signed, sealed, and delivered by source ./net, dated October 2026, and itβs literally __sock_create(9) β periodt. π
β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms