__sock_create(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 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 failure res is set to NULL. That’s not a drill. 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./net/socket.c is the group chat, and the whole friend group is right here:


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