Expand description
Terminal state tracking for /dev/console and /dev/tty*
Provides POSIX-compatible terminal attributes (struct termios equivalent) and window size tracking. The terminal state is queried and modified via SYS_IOCTL (syscall 112) with TCGETS/TCSETS/TIOCGWINSZ requests.
The state is used by the console read path to implement canonical vs raw mode, echo control, and control character handling.
Structs§
- Kernel
Termios - Linux
struct termioslayout (60 bytes). - Kernel
Winsize - Terminal window size, matching the C
struct winsizelayout. - Terminal
State - Combined terminal state for a single console device.
Constants§
- CREAD
- CS8
- ECHO
- ECHOE
- ECHOK
- HUPCL
- ICANON
- ICRNL
- IEXTEN
- ISIG
- IXON
- NCCS
- Number of control characters.
- ONLCR
- OPOST
- TCGETS
- Get terminal attributes (struct termios).
- TCSETS
- Set terminal attributes immediately.
- TCSETSF
- Set terminal attributes after draining output and flushing input.
- TCSETSW
- Set terminal attributes after draining output.
- TIOCGPGRP
- Get foreground process group ID.
- TIOCGWINSZ
- Get terminal window size (struct winsize).
- TIOCSPGRP
- Set foreground process group ID.
- TIOCSWINSZ
- Set terminal window size.
- VEOF
- VERASE
- VINTR
- VKILL
- VMIN
- VQUIT
- VSTART
- VSTOP
- VSUSP
- VTIME
Functions§
- get_
console_ terminal - Get the global console terminal state.
- get_
termios_ snapshot - Get a snapshot of the current termios (for the ioctl handler).
- get_
verase - Get the erase character from the console terminal state.
- get_
vmin - Get the VMIN value from the console terminal state.
- get_
vtime - Get the VTIME value from the console terminal state.
- get_
winsize_ snapshot - Get a snapshot of the current winsize (for the ioctl handler).
- init
- Initialize the global console terminal state.
- is_
canonical_ mode - Check if the console is in canonical (line-buffered) mode.
- is_
echo_ enabled - Check if echo is enabled on the console.
- set_
termios - Set the terminal attributes (from TCSETS/TCSETSW/TCSETSF ioctl).
- set_
winsize - Set the window size (from TIOCSWINSZ ioctl).