STRUCT SOCKADDR_UNSIZED(9)
π 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. ThinkAF_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 sockaddrhas a fixed 14-bytesa_datalimit πstruct sockaddr_storagehas a fixed 128-bytesa_datalimit π«Ά
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
- 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