sock_create_kern(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– sock_create_kern(9) πŸ’–

okay so bestie, welcome to the Kernel API Manual β€” yes we're in kernel land today, and yes this one is lowkey iconic. it's giving "let me just make a socket real quick, but make it kernel space" ✨


πŸŽ€ NAME πŸŽ€

sock_create_kern β€” creates a socket (kernel space) 🫢


🌸 SYNOPSIS 🌸

int sock_create_kern (struct net *net , int family , int type , int
protocol , struct socket **res );

like, that's the whole vibe. copy it exactly pls, no autocorrect πŸ™ˆ


✨ ARGUMENTS ✨

  • net β€” the net namespace, bestie. that's your little networking bubble πŸ’…
  • family β€” the protocol family (AF_INET, ...) β€” pick your fighter πŸ‘‘
  • type β€” the communication type (SOCK_STREAM, ...) β€” the how of it all 🌈
  • protocol β€” the protocol (0, ...) β€” yes, zero is a real answer, it's valid, don't come for it 😭
  • res β€” your brand new socket goes here, main character delivery spot 🎁

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it actually do? it's a wrapper around __sock_create, periodt. πŸ’€

it returns 0 or an error β€” that's it, that's the whole return contract, no cap.

and the little detail you literally cannot skip: this function internally uses GFP_KERNEL. that's not a vibe, that's a fact, write it down πŸ–ŠοΈ


πŸ’œ SEE ALSO πŸ’œ

okay this list is long, but we do not skip, we do not summarise, we list every single one because that's the rules πŸ’…

first up, the kernel file: ./net/socket.c, then:

go read them, i'll wait 🧚


fr fr, that's the whole page. no secret extra options hiding in here β€” what you see is what you get πŸ’–

and that's a wrap, bestie!! this one came from ./net, dated October 2026, and it's filed under sock_create_kern(9) β€” slay, go make some kernel sockets responsibly πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from