kmsg_dump_get_buffer(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– kmsg_dump_get_buffer(9) β€” like, the kernel API manual bestie πŸ’–

okay so real talk, we're in the Kernel API Manual and this function is kmsg_dump_get_buffer and it's gonna scoop up kmsg log lines for you. no cap, it's giving "archive girlie". let's go 🫢


✨ NAME ✨

kmsg_dump_get_buffer β€” copies kmsg log lines πŸ“‹


🌸 SYNOPSIS 🌸

bool kmsg_dump_get_buffer (struct kmsg_dump_iter *iter , bool syslog ,
       char *buf , size_t size , size_t *len_out );

like yes that's the whole signature, don't panic, we'll walk through every single arg πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • iter β€” the kmsg dump iterator πŸŒ€ (your lil cursor bestie)
  • syslog β€” when true, the "<4>" prefixes are included ✨
  • buf β€” the buffer you're copying the line into 🧺
  • size β€” the maximum size of that buffer πŸ“
  • len_out β€” the length of the line that actually got placed into the buffer πŸ“

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: it starts at the end of the kmsg buffer and fills the buffer you handed it with as many of the youngest kmsg records as actually fit in there. 🍼✨ If your buffer is big enough, all the available kmsg records get copied in one single call β€” one and done, iconic πŸ‘‘

Consecutive calls will fill the buffer with the next block of available older records β€” and nope, it does not include the ones it already retrieved earlier. so it keeps walking backwards, no repeats πŸ™ˆ

πŸ’€ Heads up: a return value of FALSE means there are, like, no more records to read. that's it, that's the whole message, the archive is empty, go home 😭

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./kernel/printk/printk.c

like that's a whole friend group of printk besties, go say hi to all of them fr fr 🫢


okay that's the page!! this one came from ./kernel/printk and it's dated October 2026, and the page itself is kmsg_dump_get_buffer(9) β€” k byeee, go dump some buffers responsibly πŸ’…πŸŽ€πŸ’–

πŸ“¦ where this page comes from