console_lock(9)
π console_lock β from the Kernel API Manual, bestie π
β¨ NAME β¨
console_lock β okay so this one literally blocks the whole console subsystem from printing. That's the vibe. That's the whole job. π
πΈ SYNOPSIS πΈ
void console_lock (void );
π ARGUMENTS π
voidβ no arguments, bestie. Not a single one. She takes nothing, she gives nothing back (well, she gives you a lock, see below π).
π¦ DESCRIPTION π¦
So here's the tea: console_lock acquires a lock. And that lock is a whole guarantee β it guarantees that no consoles will be in or enter their write callback. Like, nobody's mid-print, nobody's about to start printing, the write callbacks are on pause, periodt. π«Ά
Heads up, this one can sleep. So don't you dare call it from somewhere that can't nap. π΄
And after all that, it returns nothing. Void in, void out, iconic. β¨
π SEE ALSO π
Okay buckle up because the friend group is large β all of these live in the kernel file ./kernel/printk/printk.c, and honestly they're all lowkey obsessed with each other:
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_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)
π« that's the whole page, no cap π«
This lil baddie came out of ./kernel/printk and it's dated October 2026 β so yeah, she's from the future, we stan. π¦πΈπ
π¦ 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