STRUCT KVM_STATS_HEADER(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’– struct kvm_stats_header(9) โ€” the lil header that runs the whole stats operation

okay so bestie, picture this: you've got a stats fd for a vm or vcpu, and it's full of binary statistics data โ€” but you literally can't read any of it until you've read this one struct first. it's the header. the main character. the table of contents. the vibe check you gotta pass before anything else loads. periodt. โœจ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

struct kvm_stats_header {
    __u32 flags;
    __u32 name_size;
    __u32 num_desc;
    __u32 id_offset;
    __u32 desc_offset;
    __u32 data_offset;
 };

six __u32 fields. that's it. she's small but she's everything. ๐ŸŽ€


๐Ÿฆ‹ Members (the whole squad, one by one)

  • flags โ€” some extra information for the header. and by "some extra information" we meanโ€ฆ nothing rn. always 0 for now. it's giving placeholder energy but we respect her. ๐Ÿ’…
  • name_size โ€” the size in bytes of the memory that holds the statistics name string, including the trailing ' '. that memory is allocated at the send of statistics descriptor. ๐Ÿงš
  • num_desc โ€” the number of statistics the vm or vcpu has. like, how many stats we're working with. count 'em.
  • id_offset โ€” the offset of the vm/vcpu stats' id string in the file pointed by vm/vcpu stats fd. yeah. that file. you know the one. ๐ŸŒˆ
  • desc_offset โ€” the offset of the vm/vcpu stats' descriptor block in the file pointed by vm/vcpu stats fd. same file, different block, iconic behavior.
  • data_offset โ€” the offset of the vm/vcpu stats' data block in the file pointed by vm/vcpu stats fd. this is where the actual numbers live, lowkey the best part. ๐Ÿ”ฅ

๐Ÿ‘‘ Description

this is the header userspace needs to read from stats fd before any other readings. no skipping ahead, no peeking at the data block first โ€” she has to go first, that's just the rule. ๐Ÿ˜ค

userspace uses her to discover all the information about the vm/vcpu's binary statistics. everything. the whole picture. it's literally her job.

and where do you find her? userspace reads this header from the very start of the vm/vcpu's stats fd. start of the file. byte zero. right there waiting for you. ๐Ÿซถ


๐Ÿ”ฎ SEE ALSO

  • Kernel file ./tools/include/uapi/linux/kvm.h
  • struct kvm_stats_desc(9) โ€” her bestie, go read that one next

โญ reminder bestie: read the header first, from the start of the stats fd, before any other readings. do not freestyle this. ๐Ÿ™ˆ

and that's the whole page, no cap ๐Ÿ’œ โ€” this came from ./tools/include/uapi/linux, dated October 2026, and it's the struct kvm_stats_header(9) manual page. slay, go read your stats. ๐Ÿ“โœจ

๐Ÿ“ฆ where this page comes from