STRUCT SOCKADDR_UNSIZED(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct sockaddr_unsized(9) πŸ’…

okay so bestie, welcome to the Kernel API Manual β€” today's main character is struct sockaddr_unsized, and she is literally the flexible friend your callbacks have been waiting for πŸ¦‹


✨ NAME ✨

struct sockaddr_unsized β€” an unspecified-size sockaddr made for callbacks πŸŽ€


🌸 SYNOPSIS 🌸

struct sockaddr_unsized {
    __kernel_sa_family_t sa_family;
    char sa_data[];
 };

πŸ’– Members πŸ’–

  • sa_family β€” the address family, iykyk. Think AF_UNIX, AF_INET, AF_INET6, etc. πŸ‘‘
  • sa_data β€” the flexible array holding the actual address data. she stretches, she adapts, she's iconic ✨

🧚 Description 🧚

so here's the vibe: this structure was designed for callback interfaces where the total size is already known via the sockaddr_len parameter. no guessing, no drama, the size comes from outside πŸ’…

and like, let's talk about her sisters for a sec:

  • struct sockaddr has a fixed 14-byte sa_data limit πŸ™ˆ
  • struct sockaddr_storage has a fixed 128-byte sa_data limit 🫢

not this one tho. struct sockaddr_unsized can accommodate addresses of any size β€” so she can do it all, no cap. πŸ”₯

but bestie, hear me: she must be used carefully. this is not a "vibe and see what happens" situation, fr fr. the size lives in sockaddr_len, so you'd better be keeping track of it. 😭

🌈 SEE ALSO 🌈

  • Kernel file ./tools/perf/trace/beauty/include/linux/socket.h β€” go read it, it's giving source of truth πŸ“–πŸ’œ

anyway that's the page, bestie!! keep those sizes tracked and those callbacks slaying πŸ’…βœ¨

sign-off time: this lil masterpiece comes from ./tools/perf/trace/beauty/incl... and is dated October 2026 β€” so like, future iconic behavior fr πŸŽ€πŸŒŸ

πŸ“¦ where this page comes from