STRUCT SOCKET(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so bestie, welcome to the struct socket(9) page in the Kernel API Manual β€” this is literally all about the general BSD socket πŸ‘‘βœ¨. We’re gonna go through every single field, no skipping, no cap πŸ’….


✨ SYNOPSIS ✨

here’s the whole struct, copied exactly, do not touch the formatting bestie 🫢:

       struct socket {
           socket_state state;
           short type;
           unsigned long           flags;
           struct file             *file;
           struct sock             *sk;
           const struct proto_ops  *ops;
           struct socket_wq        wq;
        };

🫢 Members 🫢

okay now the members, one by one, because every field is iconic in its own way πŸ’…:

  • state β€” socket state (SS_CONNECTED, etc) πŸ’–
  • type β€” socket type (SOCK_STREAM, etc) πŸŽ€
  • flags β€” socket flags (SOCK_NOSPACE, etc) ✨
  • file β€” File back pointer for gc 🧚
  • sk β€” internal networking protocol agnostic socket representation πŸ¦‹
  • ops β€” protocol specific socket operations πŸ”₯
  • wq β€” wait queue for several uses 🌸

🌈 SEE ALSO 🌈

if you wanna keep reading, these are the references, fr fr:

  • Kernel file ./include/linux/net.h
  • struct sockopt(9)
  • enum sock_type(9)
  • enum sock_shutdown_cmd(9)

okay that’s the whole page! this cutie comes from ./include/linux, dated October 2026, and it’s the struct socket(9) manual page β€” bye bestie, slay your kernel adventures πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from