add_preferred_console(9)
π add_preferred_console(9)
okay so you're reading a page from the Kernel API Manual β yes, the kernel, the literal main character of your whole computer β and this one's about telling the kernel which console it should be obsessed with. let's get into it π
β¨ NAME β¨
add_preferred_console β adds a device to the list of preferred consoles. that's it, that's the whole vibe π«Ά
πΈ SYNOPSIS πΈ
int add_preferred_console (const char *name , const short idx , char
*options );
π¦ ARGUMENTS π¦
nameβ the device name π« like, who is this consoleidxβ the device index π’ which one of them, bestieoptionsβ the options for this console π all the little extras it gets
π DESCRIPTION π
okay so the tea is: the last preferred console you add is the one that gets used for kernel messages and for stdin/out/err for init. last one in wins, no cap, main character energy π
normally this is used by console_setup above to handle user-supplied console arguments β like when you type console stuff on the kernel command line and it's like "say less, i got you" π
but also!! it can be used by arch-specific code, either to override the user, or β more commonly β to provide a default console (ie from PROM variables) when the user has not supplied one. so if the user ghosted the console args, arch code can step in and be like "don't worry bestie, i'll pick" π§
π₯ SEE ALSO π₯
Kernel file ./kernel/printk/printk.c β and honestly the whole friend group:
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)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)
ngl, that's a long SEE ALSO. the printk girlies stay booked and busy π but every single one of them is listed up there, so go click around, iykyk β
π and that's the page!! this one lives in ./kernel/printk and the version date on it is October 2026 β so yeah, she's from the future, iconic behavior honestly ππ stay slay, read your manpages, and may your console always be the preferred one π
β¨
π¦ 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