Commit 59365fa
feat(tty): Implement missing TTY termios ioctls (TCSETSF, TCSETA*) (#2141)
feat(tty): complete Linux-compatible termios and serial semantics
Implement the legacy TCGETA/TCSETA ioctl family and the drain and
flush behavior required by TCSETSW, TCSETSF, TCSETAW, and TCSETAF.
Preserve termio flag merging, c_line ABI values, control characters,
baud-rate encoding, job-control checks, and safe userspace copy-out
semantics in line with Linux 6.6.
Track retained N_TTY output and use interruptible, event-driven drain
waits with correct handling for partial writes, signals, hangups, and
peer teardown.
Add bounded PTY staging queues and deferred peer delivery to preserve
write ordering while avoiding cross-endpoint termios lock deadlocks.
Align PTY polling, packet mode, flushing, unthrottling, and per-file
hangup behavior with Linux semantics.
Replace direct serial8250 PIO writes with an interrupt-driven TX queue,
apply termios framing settings to hardware, implement bounded physical
transmitter waits, and correctly route legacy COM ports over IRQ3 and
IRQ4. Serialize console, emergency, and runtime output and notify
blocking and epoll writers when TX capacity becomes available.
Make TTY fasync and hangup state follow individual open file
descriptions. Serialize F_SETFL updates with lifecycle cleanup and
unregister stale TTY, pipe, and socket fasync entries on final release.
Add focused termios, PTY hangup, tcflush, and fasync regression tests,
and validate independent COM2 transmission without relying on IRQ4
traffic.
Co-authored-by: longjin <longjin@dragonos.org>
Co-authored-by: kado <2448956191@qq.com>
Signed-off-by: kado <2448956191@qq.com>
Signed-off-by: longjin <longjin@dragonos.org>1 parent 1f4e6b6 commit 59365fa
24 files changed
Lines changed: 3006 additions & 232 deletions
File tree
- kernel/src
- driver
- serial
- serial8250
- tty
- pty
- tty_ldisc
- virtual_terminal
- filesystem/vfs
- syscall
- ipc
- net/socket
- user/apps
- c_unitest
- tests/dunitest
- suites/normal
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | 76 | | |
| |||
0 commit comments