ENUM TTY_DRIVER_FLAG(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… NAME πŸ’…

okay so bestie, this is the enum tty_driver_flag(9) page from the Kernel API Manual β€” it's literally all about TTY Driver Flags πŸŽ€ and the way these little enum values control how the tty core treats your driver. no cap, this one's a banger for anyone writing tty drivers.


✨ SYNOPSIS ✨

enum tty_driver_flag {
    TTY_DRIVER_INSTALLED ,
    TTY_DRIVER_RESET_TERMIOS ,
    TTY_DRIVER_REAL_RAW ,
    TTY_DRIVER_DYNAMIC_DEV ,
    TTY_DRIVER_DEVPTS_MEM ,
    TTY_DRIVER_HARDWARE_BREAK ,
    TTY_DRIVER_DYNAMIC_ALLOC ,
    TTY_DRIVER_UNNUMBERED_NODE ,
    TTY_DRIVER_NO_WORKQUEUE ,
    TTY_DRIVER_RESET_SAVED_TERMIOS

};

πŸŽ€ Constants πŸŽ€

bestie, here's the full roster, one by one, no skips πŸ’–

  • TTY_DRIVER_INSTALLED β€” whether this driver was succesfully installed. this one is a tty internal flag. do not touch. like, hands off, fr fr πŸ™ˆ
  • TTY_DRIVER_RESET_TERMIOS β€” asks the tty layer to reset the termios setting when the last process has closed the device. used for PTYs, in particular πŸ‘‘
  • TTY_DRIVER_REAL_RAW β€” says the driver guarantees it won't set any special character handling flags if this is set for the tty. (the exact condition lives down in Description, keep scrolling πŸ’…)
  • TTY_DRIVER_DYNAMIC_DEV β€” the individual tty devices gotta be registered with a call to tty_register_device when the device is found in the system, and unregistered with a call to tty_unregister_device, so the devices will be show up properly in sysfs. if it's not set, all tty_driver.num entries will be created by the tty core in sysfs when tty_register_driver is called. this is to be used by drivers that have tty devices that can appear and disappear while the main tty driver is registered with the tty core πŸ¦‹
  • TTY_DRIVER_DEVPTS_MEM β€” don't use the standard arrays (tty_driver.ttys and tty_driver.termios), instead use dynamic memory keyed through the devpts filesystem. this is only applicable to the PTY driver 🌸
  • TTY_DRIVER_HARDWARE_BREAK β€” hardware handles break signals. pass the requested timeout to the tty_operations.break_ctl instead of using a simple on/off interface ⚑
  • TTY_DRIVER_DYNAMIC_ALLOC β€” do not allocate structures which are needed per line for this driver (tty_driver.ports) as it would waste memory. the driver will take care. this is only applicable to the PTY driver 🧚
  • TTY_DRIVER_UNNUMBERED_NODE β€” do not create numbered /dev nodes. for example, create /dev/ttyprintk and not /dev/ttyprintk0. applicable only when a driver for a single tty device is being allocated ✨
  • TTY_DRIVER_NO_WORKQUEUE β€” do not create workqueue when tty_register_driver. whenever set, flip buffer workqueue can be set by tty_port_link_wq for every port πŸ’€
  • TTY_DRIVER_RESET_SAVED_TERMIOS β€” reset any saved termios settings on device registration when reusing a minor number. must only be set by drivers that guarantee that the minor number is no longer in use. like, that's a promise you actually have to keep 😭

🌈 Description 🌈

okay so these are flags passed to tty_alloc_driver. that's the whole vibe ✨

and here's the exact condition for that TTY_DRIVER_REAL_RAW promise, copy-pasted with love:

(IGNBRK || (!BRKINT && !PARMRK)) && (IGNPAR || !INPCK)

that is, if there is no reason for the driver to send notifications of parity and break characters up to the line driver, it won't do so. this allows the line driver to optimize for this case if this flag is set. (note that there is also a promise, if the above case is true, not to signal overruns, either.) β€” yeah, it's giving "two promises for the price of one" 🫢


πŸ’– SEE ALSO πŸ’–

go read these next, bestie, they're literally the supporting cast πŸ‘‘

  • Kernel file ./include/linux/tty_driver.h
  • struct tty_operations(9)
  • struct tty_driver(9)
  • tty_alloc_driver(9)

and that's the whole page, periodt πŸ’… this came straight out of ./include/linux and it's dated October 2026, so like… future iconic behavior fr fr 🌟 mwah, go write some slay tty drivers πŸ’œ

πŸ“¦ where this page comes from