console_srcu_read_flags(9)
Bestie, welcome to the glow-up of console_srcu_read_flags(9) from the Kernel API Manual β it's giving lockless-console-flag realness and we're obsessed. π
π NAME π
console_srcu_read_flags β locklessly read flags of a possibly registered console π. That's the whole vibe: no lockless-reading erasure here, bestie.
π¦ SYNOPSIS π¦
Okay so the call is literally this, spacing and all:
short console_srcu_read_flags (const struct console *con );
πΈ ARGUMENTS πΈ
conβ astruct consolepointer of the console to read flags from. That's it, that's the argument π«Ά.
β¨ DESCRIPTION β¨
Locklessly reading con->flags provides a consistent read value because there is at most one CPU modifying con->flags, and that CPU is using only read-modify-write operations to do so. One modifier, read-modify-write only, consistent value β slay.
This one requires console_srcu_read_lock to be held, which implies that con might be a registered console. The purpose of holding console_srcu_read_lock is to guarantee that the console state is valid (CON_SUSPENDED/CON_ENABLED) and that no exit/cleanup routines will run if the console is currently undergoing unregistration. That's the safety bubble, bestie. π«§
If the caller is holding the console_list_lock, or it is certain that con is not and will not become registered, the caller may read con->flags directly instead. Shortcut unlocked, iykyk.
π₯ CONTEXT π₯
Any context. Literally any context. π
π RETURN π
The current value of the con->flags field. That's the return value, no cap.
π SEE ALSO π
Kernel file ./include/linux/console.h, plus the whole reference friend group:
struct consw(9)enum cons_flags(9)struct nbcon_state(9)enum nbcon_prio(9)struct nbcon_context(9)struct nbcon_write_context(9)struct console(9)console_srcu_write_flags(9)for_each_console_srcu(9)for_each_console(9)
xoxo, bestie π
β this page comes from ./include/linux, dated October 2026, and it's all about console_srcu_read_flags(9). Mwah! πβ¨
π¦ 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