gnet_stats_s..._copy_compat(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 with struct tc_stats TLV. 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:

  1. Initializes the dumping handle (that's d, bestie).
  2. Grabs the statistic lock β€” highkey important, don't skip this πŸ”₯
  3. 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 0 on success πŸŽ‰
  • Returns -1 if 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 πŸ¦‹

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