kmsg_dump_get_buffer(9)
π 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
console_list_lock(9)console_list_unlock(9)console_srcu_read_lock(9)console_srcu_read_unlock(9)console_lock_spinning_enable(9)console_lock_spinning_disable_and_check(9)console_trylock_spinning(9)printk_parse_prefix(9)add_preferred_console(9)match_devname_and_update_preferred_console(9)console_suspend_all(9)console_cpu_notify(9)console_lock(9)console_trylock(9)console_unlock(9)console_flush_on_panic(9)printk_kthreads_shutdown(9)console_force_preferred_locked(9)pr_flush(9)wake_up_klogd(9)defer_console_output(9)printk_trigger_flush(9)printk_timed_ratelimit(9)kmsg_dump_register(9)kmsg_dump_unregister(9)kmsg_dump_desc(9)kmsg_dump_get_line(9)kmsg_dump_rewind(9)console_try_replay_all(9)__printk_cpu_sync_wait(9)__printk_cpu_sync_try_get(9)__printk_cpu_sync_put(9)
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
- 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