ENUM TTY_STRUCT_FLAGS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 implement TIOCSPTLCK/TIOCGPTLCK logic. 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. Use tty_io_nonblock to check. lowkey important: do not block here, check with tty_io_nonblock first ⭐
  • 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:


✨ 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