gnet_stats_copy_basic_hw(9)
π 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βtrueifbrepresents a running qdisc, thusb's internal values might change during basic reads. only used ifcpuisNULLβ οΈ like, don't forget that part, bestie
lowkey important:runninggets ignored unlesscpuisNULL. 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:
gnet_stats_start_copy_compat(9)gnet_stats_start_copy(9)gnet_stats_copy_basic(9)gnet_stats_copy_rate_est(9)gnet_stats_copy_queue(9)gnet_stats_copy_app(9)gnet_stats_finish_copy(9)
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
- 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