gnet_stats_s..._copy_compat(9)
π gnet_stats_start_copy_compat(9) π
okay so this is a page straight out of the Kernel API Manual, and it's literally the origin story of your stats dump β the "compatibility mode" edition. bestie, if you've ever wondered how the kernel keeps old userspace from having a breakdown, this is it π«Ά
β¨ SYNOPSIS β¨
int gnet_stats_start_copy_compat (struct sk_buff *skb , int type , int
tc_stats_type , int xstats_type , spinlock_t *lock , struct gnet_dump *d
, int padattr );
π ARGUMENTS π
skbβ the socket buffer you're dumping all your stats TLVs into. it's the vibe container, the canvas, the whole point πΈtypeβ TLV type for the top level statistic TLV. the main character TLV, iykyk.tc_stats_typeβ TLV type used for backward compatibility withstruct tc_statsTLV. yes, that's the old one, we still love her πxstats_typeβ TLV type for the backward compatibility xstats TLV. more legacy lore, no cap.lockβ the statistics lock. grab it, hold it, respect it πdβ the dumping handle. your lil work-in-progress state buddy.padattrβ the padding attribute. because alignment is self-care, periodt β¨
π DESCRIPTION π
So what does it actually do? Three iconic things, in order:
- Initializes the dumping handle (that's
d, bestie). - Grabs the statistic lock β highkey important, don't skip this π₯
- Appends an empty TLV header to the socket buffer, so there's a container ready to hold all the other statistic TLVs. it's giving "put a little empty box down first" energy π
Then the fun part: the dumping handle gets marked to be in backward compatibility mode, which tells all the gnet_stats_copy_XXX functions to fill a local copy of struct tc_stats. the way that one flag ripples through everythingβ¦ iconic π
Return value check, because we do care about that:
- Returns
0on success π - Returns
-1if the room in the socket buffer was not sufficient π (yes, that's a real failure mode, keep the check in your code, don't be that girl)
ngl if you ignore that -1 you're gonna have a bad time. the buffer said no. respect the buffer π
π¦ SEE ALSO π¦
- Kernel file
./net/core/gen_stats.c gnet_stats_start_copy(9)gnet_stats_copy_basic(9)gnet_stats_copy_basic_hw(9)gnet_stats_copy_rate_est(9)gnet_stats_copy_queue(9)gnet_stats_copy_app(9)gnet_stats_finish_copy(9)
like, read the whole little family, they're all in gen_stats.c together and they're all doing their part β¨
okay that's the whole page, you ate it up π
mwah. this came to you from ./net/core, dated October 2026, and yes it's still filed under that squished-up title gnet_stats_s..._copy_compat(9) because man page names gonna man page name ππ«Ά
π¦ 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