console_srcu_read_lock(9)
π console_srcu_read_lock(9) β from the Kernel API Manual, bestie π«Ά
Okay so picture this: you're deep in the kernel printk lore and you need to walk the console list without the whole thing falling apart. That's the vibe. This is page console_srcu_read_lock(9) and it's literally your entry ticket, so let's go β¨
πΈ NAME πΈ
console_srcu_read_lock β register a new reader for the SRCU-protected console list π
Like, you're signing the guest book so the console list knows you're in the building. No cap.
β¨ SYNOPSIS β¨
int console_srcu_read_lock (void );
π ARGUMENTS π
voidβ no arguments, babe. Nothing to pass in. She takes nothing and she gives you back a cookie. Iconic behaviour honestly.
π¦ DESCRIPTION π¦
Bestie, the whole point: use for_each_console_srcu to iterate the console list. That's it. That's the assignment. You call this, you do your little stroll through the console list with for_each_console_srcu, and you're golden π
β CONTEXT β
Any context. ANY. Fr fr β you can call this from wherever you happen to be vibing. π
π₯ RETURN π₯
She returns a cookie πͺ β and you will hand that cookie straight to console_srcu_read_unlock when you're done. Don't lose it, don't eat it, just pass it along. Periodt.
π SEE ALSO π
Kernel file ./kernel/printk/printk.c, plus the whole squad, in order:
console_list_lock(9)console_list_unlock(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_get_buffer(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)
Read them all. Yes, all of them. I said what I said ππ§
Lowkey reminder: lock it, iterate it, unlock it with that cookie. Crying over a leaked SRCU reader is not the main character energy we're going for π
Mwah π this page lives in ./kernel/printk, dated October 2026, and answers to the name console_srcu_read_lock(9). Byeee π¦β¨
π¦ 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