gnet_stats_copy_basic_hw(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gnet_stats_copy_basic_hw(9) β€” the Kernel API Manual bestie era ✨

okay so this is a page from the Kernel API Manual, and honestly? it's a little function that does one job and does it well. no cap. let's get into it 🫢


🌸 NAME 🌸

gnet_stats_copy_basic_hw β€” copy basic hw statistics into statistic TLV

like, that's literally the whole vibe: it takes your basic hardware stats and copies them into the statistic TLV. iconic behavior πŸŽ€


✨ SYNOPSIS ✨

int gnet_stats_copy_basic_hw (struct gnet_dump *d , const struct
gnet_stats_basic_sync __percpu *cpu , const struct gnet_stats_basic_sync
*b , bool running );

look at her go 😭 four arguments, one int return, zero notes. she's booked and busy.


πŸ¦‹ ARGUMENTS πŸ¦‹

  • d β€” the dumping handle. your main character for this whole operation πŸ’…
  • cpu β€” copy statistic per cpu. yes, per cpu, we're being thorough πŸ”₯
  • b β€” the basic statistics themselves. the actual lore ✨
  • running β€” true if b represents a running qdisc, thus b's internal values might change during basic reads. only used if cpu is NULL ⚠️ like, don't forget that part, bestie
lowkey important: running gets ignored unless cpu is NULL. that's the whole rule. iykyk πŸ™ˆ

🌈 CONTEXT 🌈

task; must not be run from IRQ or BH contexts πŸ’€

fr fr β€” task context only. do not come at this from IRQ or BH contexts, it's not that kind of function, and honestly? respect the boundaries πŸ‘‘


πŸ’– DESCRIPTION πŸ’–

Appends the basic statistics to the top level TLV created by gnet_stats_start_copy. 🧚

Returns 0 on success or -1 with the statistic lock released if the room in the socket buffer was not sufficient. 😭

so basically: it appends, it returns 0 when everything slays, and it returns -1 β€” and releases the statistic lock β€” when there just wasn't enough room in the socket buffer. not me crying over a socket buffer πŸ’€ the lock release is a whole detail, don't skip it 🫢


⭐ SEE ALSO ⭐

Kernel file ./net/core/gen_stats.c β€” and the whole friend group of copy functions, all linked up:

the squad πŸ’œ go read all of them, bestie, they all ate 🌸


πŸ“ sign-off πŸ“

this absolute queen lives in ./net/core, and this page is stamped October 2026 β€” so yeah, she's from the future, and she's still serving πŸ‘‘βœ¨

stay hydrated, release your locks, and don't run this from IRQ context πŸ’…πŸ¦‹ bye bestie!

πŸ“¦ where this page comes from