gnet_stats_copy_queue(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– gnet_stats_copy_queue(9) πŸ’–

okay bestie, welcome to the Kernel API Manual ✨ this one's a little kernel function from ./net/core and she's literally the queue-statistics bestie you didn't know you needed 🫢


🌸 NAME 🌸

gnet_stats_copy_queue β€” copy queue statistics into statistics TLV πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

int gnet_stats_copy_queue (struct gnet_dump *d , const struct
       gnet_stats_queue __percpu *cpu_q , const struct gnet_stats_queue *q ,
       __u32 qlen );

like, that's the whole signature, no cap β€” four arguments and an int return, iconic 🌈


πŸ¦‹ ARGUMENTS πŸ¦‹

  • d β€” the dumping handle 🎯 your main character, the thing doing the dumping
  • cpu_q β€” per cpu queue statistics 🧚 yes, per cpu, she's a __percpu pointer and everything
  • q β€” queue statistics πŸ“ the regular, non-per-cpu stats bestie
  • qlen β€” queue length statistics πŸ“ a __u32, keeping it cute and numeric

✨ DESCRIPTION ✨

So what she actually does: she appends the queue statistics to the top level TLV that was created by gnet_stats_start_copy πŸ’« and she uses the per cpu queue statistics if they are available β€” like, if they're there, she's using them, periodt πŸ‘‘

Returns 0 on success πŸ₯³ or -1 with the statistic lock released if the room in the socket buffer was not sufficient 😭 β€” and yes, the lock being released on that -1 path is important, ngl, don't sleep on it.

⚠️ lowkey important: on -1, the statistic lock gets released. that's part of the deal, fr fr πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


and that's the whole page, bestie πŸ’œ she lives in ./net/core, dated October 2026, and honestly? slay πŸŽ€ go copy some queue statistics, iykyk 🌟

πŸ“¦ where this page comes from