ENUM TTY_STRUCT_FLAGS(9)
π enum tty_struct_flags(9) π
okay so bestie, welcome to the Kernel API Manual β this is the page for enum tty_struct_flags, aka the TTY Struct Flags, and honestly? it's giving backstage-pass energy. these are the little bits that live inside a tty and quietly tell everyone what's going on. let's get into it β¨
πΈ NAME πΈ
enum tty_struct_flags β TTY Struct Flags. that's it, that's the whole vibe. it's an enum, it holds flags, and the flags are for ttys. slay.
π¦ SYNOPSIS π¦
here's the whole squad, in order, no cap β every single one of them:
enum tty_struct_flags {
TTY_THROTTLED ,
TTY_IO_ERROR ,
TTY_OTHER_CLOSED ,
TTY_EXCLUSIVE ,
TTY_DO_WRITE_WAKEUP ,
TTY_LDISC_OPEN ,
TTY_PTY_LOCK ,
TTY_NO_WRITE_SPLIT ,
TTY_HUPPED ,
TTY_HUPPING ,
TTY_LDISC_CHANGING ,
TTY_LDISC_HALTED
};
twelve flags, zero skips. we love a complete list π
π Constants π
okay now the main character moment β one by one, what each flag actually means:
TTY_THROTTLEDβ Driver input is throttled π. the ldisc should call:c:member:tty_driver.unthrottle`` to resume reception when it's ready to process more data (at threshold min). basically: "hold up, I'm full, lemme breathe" and then it un-holds itself π«ΆTTY_IO_ERRORβ If set, causes all subsequent userspace read/write calls on the tty to fail, returning-EIO. (May be no ldisc too.) so like, every read and write after this just π β and yeah, there may be no ldisc either, fun!TTY_OTHER_CLOSEDβ Device is a pty and the other side has closed. one half of the pair dipped π it's fine. everything's fine.TTY_EXCLUSIVEβ Exclusive open mode (a single opener). one opener, no plus-ones. this is a private party πTTY_DO_WRITE_WAKEUPβ If set, causes the driver to call the:c:member:tty_ldisc_ops.write_wakeup`` method in order to resume transmission when it can accept more data to transmit. the "hey I can take more, wake me up" flag π₯TTY_LDISC_OPENβ Indicates that a line discipline is open. For debugging purposes only. ngl bestie this one is literally just for looking at, don't build a whole feature on it πTTY_PTY_LOCKβ A flag private to pty code to implementTIOCSPTLCK/TIOCGPTLCKlogic. very much "staff only" β private to pty code, mind your business πͺTTY_NO_WRITE_SPLITβ Prevent driver from splitting up writes into smaller chunks (preserve write boundaries to driver). your write stays one write. boundaries preserved, integrity intact πTTY_HUPPEDβ The TTY was hung up. This is set post:c:member:tty_driver.hangup``. already happened, past tense, it's over πTTY_HUPPINGβ The TTY is in the process of hanging up to abort potential readers. mid-breakup energy π the whole point is to abort potential readers.TTY_LDISC_CHANGINGβ Line discipline for this TTY is being changed. I/O should not block when this is set. Usetty_io_nonblockto check. lowkey important: do not block here, check withtty_io_nonblockfirst βTTY_LDISC_HALTEDβ Line discipline for this TTY was stopped. No work should be queued to this ldisc. like, zero. none. do not queue work to a halted ldisc, periodt π
π Description π
These bits are used in the :c:member:tty_struct.flags`` field. that's their home. that's where they live π
okay and here's the part where it gets real β the concurrency tea β: so that interrupts won't be able to mess up the queues, copy_to_cooked must be atomic with respect to itself, as must tty->write. Thus, you must use the inline functions set_bit and clear_bit to make things atomic. no cap, this is not optional β use the inline set_bit and clear_bit or the queues get got by an interrupt π
π§ SEE ALSO π§
go touch these next, iykyk:
- Kernel file
./include/linux/tty.hstruct tty_struct(9) tty_kref_get(9)tty_get_baud_rate(9)
β¨ and that's the page, bestie! brought to you from ./include/linux, dated October 2026 β see you in the next man page, 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