for_each_console_srcu(9)
π for_each_console_srcu
okay so this is a page from the Kernel API Manual β yes we're literally in kernel land, get comfy π«Ά
β¨ NAME β¨
for_each_console_srcu β the lil iterator that walks over all the registered consoles π
π SYNOPSIS π
for_each_console_srcu (con );
πΈ ARGUMENTS πΈ
conβ astruct consolepointer that's doing double duty as your loop cursor. it's the main character of the loop, basically π«
π¦ DESCRIPTION π¦
so here's the tea β β SRCU does guarantee that the console list stays consistent, but ngl, the individual struct console fields? those can still get updated by other CPUs while you're mid-iteration. so likeβ¦ the list is stable, the contents are lowkey moving. iykyk π
π¨ bestie listen: this requires console_srcu_read_lock to be held. no lock, no vibes. periodt.
the good news? it can be invoked from any context β¨ so wherever you are, you're valid.
π SEE ALSO π
go off and read these next, they're all iconic in their own way π
- Kernel file
./include/linux/console.h 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_read_flags(9)console_srcu_write_flags(9)for_each_console(9)
πΈ and that's the whole page, bestie! source lives in ./include/linux, dated October 2026, and it's the for_each_console_srcu(9) manual page β¨ slay, go iterate 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