ENUM TTY_DRIVER_FLAG(9)
π 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 totty_register_devicewhen the device is found in the system, and unregistered with a call totty_unregister_device, so the devices will be show up properly in sysfs. if it's not set, alltty_driver.numentries will be created by the tty core in sysfs whentty_register_driveris 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.ttysandtty_driver.termios), instead use dynamic memory keyed through thedevptsfilesystem. this is only applicable to the PTY driver πΈTTY_DRIVER_HARDWARE_BREAKβ hardware handles break signals. pass the requested timeout to thetty_operations.break_ctlinstead 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/devnodes. for example, create/dev/ttyprintkand not/dev/ttyprintk0. applicable only when a driver for a single tty device is being allocated β¨TTY_DRIVER_NO_WORKQUEUEβ do not create workqueue whentty_register_driver. whenever set, flip buffer workqueue can be set bytty_port_link_wqfor 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
- 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