STRUCT NBCON_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct nbcon_state(9) β€” the vibe check on nbcon console state

okay bestie, welcome to the Kernel API Manual ✨ this one's short and sweet, so grab your iced coffee πŸ“

🌸 NAME 🌸

struct nbcon_state β€” console state for nbcon consoles. that's it, that's the whole name. iconic brevity πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

like, here's the actual struct, copied character for character because we do not mess with the source 🫢

       struct nbcon_state {
           union {
             unsigned int    atom;
             struct {
               unsigned int prio               :  2;
               unsigned int req_prio           :  2;
               unsigned int unsafe             :  1;
               unsigned int unsafe_takeover    :  1;
               unsigned int cpu                : 24;
             };
           };
        };

✨ Members ✨

okay so this is where it gets juicy, let's go through every single one because we don't skip πŸ’–

  • {unnamed_union} β€” anonymous. yes babe, it has no name, it's mysterious like that πŸ™ˆ
  • atom β€” the compound of the state fields, made for atomic operations. so you can grab the whole thing in one shot, no cap πŸ”₯
  • {unnamed_struct} β€” also anonymous. two anonymous things in one struct, it's giving main character energy πŸ‘‘
  • prio β€” the priority of the current owner. the real one, the one actually holding it πŸ’…
  • req_prio β€” the priority of a handover request. like someone politely (or not) asking for the unlock 🫢
  • unsafe β€” console is busy in a non takeover region. lowkey do NOT touch this one 😭
  • unsafe_takeover β€” a hostile takeover in an unsafe state happened in the past. the console cannot be safe until re-initialized. fr fr, this is a permanent scar until you re-init πŸ’€
  • cpu β€” the CPU on which the owner runs. 24 bits of "who's your CPU bestie" 🌈

πŸ¦‹ Description πŸ¦‹

so what's this struct for? it's to be used for reading and preparing of the value stored in the nbcon state variable console::nbcon_state. that's the whole job, and it slays at it ✨

now here's the important bit, ngl β€” the prio and req_prio fields are particularly important. why? because they allow spin-waiting to timeout and give up without the risk of a waiter being assigned the lock after giving up. like, no phantom lock handoff, none of that chaos. that's the whole reason these fields exist and they ate πŸ’…πŸ”₯

🧚 SEE ALSO 🧚

go read these next, i promise they're worth it:


and that's the page bestie!! πŸŽ€ brought to you from ./include/linux, dated October 2026, in the Kernel API Manual β€” struct nbcon_state(9) out, mwah πŸ’‹πŸ’–

πŸ“¦ where this page comes from