__struct_group(9)
π NAME π
__struct_group β makes you a mirrored named struct and an anonymous one, bestie β¨ (the page spells it "anonyomous" and honestly? iconic. we're keeping the vibe π)
πΈ SYNOPSIS πΈ
__struct_group (TAG , NAME , ATTRS , MEMBERS... );
π¦ ARGUMENTS π¦
TAGβ the tag name for the named sub-struct. Usually it's justβ¦ empty. No thoughts, head empty, tag empty πNAMEβ the identifier name of the mirrored sub-struct. This is the one with main character energy πATTRSβ any struct attributes. Also usually empty, we love a low-effort queen πMEMBERSβ the member declarations for the mirrored structs. This is the actual content, the moment, the reason we're all here π«Ά
π₯ DESCRIPTION π₯
Okay so here's the tea β β this macro builds you an anonymous union of two structs that have identical layout and size: one of them anonymous, one of them named. Literally twins. Same fit, different name tag π
The way this works for you:
- The anonymous one's members can be used normally, with no sub-struct naming at all β just say the member's name and go, no cap π«
- The named one lets you reason about the start, the end, and the size of the group of struct members. It's giving "I need to know where this block begins and ends" energy π
And because that's not enough slay for one macro: the named struct can also be explicitly tagged for layer reuse (C only, bestie β C only π), and both structs can have struct attributes appended to them. Both. Equally. Periodt π β¨
β SEE ALSO β
Kernel file ./tools/include/uapi/linux/stddef.hβ go read it, it's the source of truth, iykyk π__DECLARE_FLEX_ARRAY(9)β its bestie, go say hi π¦
ngl this whole thing is one of those "small macro, huge consequences" situations β mirrored layout and size is not a suggestion, it's the whole point π
mwah, that's the page! brought to you by the fine folks at ./tools/include/uapi/linux, dated October 2026 β go forth and mirror your structs, 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