struct_group_attr(9)
π struct_group_attr π
okay so bestie, welcome to the Kernel API Manual page for struct_group_attr β yes, this is a real man page from the kernel docs, and yes, it's lowkey iconic π
β¨ NAME β¨
struct_group_attr β the one that creates a struct_group() with trailing attributes π¦
β¨ SYNOPSIS β¨
struct_group_attr (NAME , ATTRS , MEMBERS... );
like that's the whole vibe. no cap, that's the signature, don't touch it π
β¨ ARGUMENTS β¨
NAMEβ the identifier name of the mirrored sub-struct. basically the name tag for the named twin π·οΈATTRSβ any struct attributes you wanna apply. this is the part that earns the_attrin the name, periodt β¨MEMBERSβ the member declarations for the mirrored structs. the actual contents, the main character energy of the whole thing π
β¨ DESCRIPTION β¨
so here's the tea β β this is used to create an anonymous union of two structs with identical layout and size: one anonymous and one named.
the former (the anonymous one) can be used normally without sub-struct naming β just vibes, no prefix needed. and the latter (the named one) can be used to reason about the start, end, and size of the group of struct members π«Ά
and the whole point of this specific one: it includes structure attributes argument β that's the ATTRS bit, that's the flex π
β¨
ngl this is the struct_group()-but-with-attributes variant, so if you don't need attributes, go hang with the plain one instead π§
β¨ SEE ALSO β¨
- kernel file
./include/linux/stddef.hβ the home base for all this π sizeof_field(9)offsetofend(9)struct_group(9)struct_group_tagged(9)DECLARE_FLEX_ARRAY(9)__TRAILING_OVERLAP(9)TRAILING_OVERLAP(9)
like, the whole friend group fr fr πΈ
and that's the page!! much love from ./include/linux, dated October 2026, brought to you by the kernel docs gang β slay, study up, and go read stddef.h bestie πππ¦
π¦ 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