mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2026-09-08 23:57:59 +08:00
* fix(tty): implement TCXONC flow control Implement the four TCXONC actions in N_TTY with job-control checks, committed termios snapshots, atomic output state transitions, and a driver xchar hook with a generic fallback. Teach serial8250 to pause ordinary output while prioritizing flow-control characters, keep TX interrupt decisions consistent across console and IRQ paths, and reset private flow state across the first-open/last-close lifecycle. Preserve PTY packet notifications and gate virtual-terminal writes on the shared stopped state. Add dunitest coverage for action validation, blocked-writer wakeups, custom and disabled control characters, output-postprocessing bypass, and idempotent PTY packet notifications. Validation: - make fmt - make kernel - tty_termios: 20/20 passed in DragonOS - tty_tcflush: 6/6 passed in DragonOS - tty_pty_hangup: 36/36 passed in DragonOS - Python Ctrl+C produced KeyboardInterrupt without a kernel panic Signed-off-by: longjin <longjin@dragonos.org> * fix(tty): address flow-control races Serialize the xchar fallback snapshot behind the TTY write lock and track external flow-control transitions. Restore a temporary stop only when no concurrent start or stop request superseded it, and issue deferred write readiness after dropping all re-entrant locks when a racing start observed the temporary running state. Match Linux tty_port_close_start semantics for serial8250 by discarding a TCO-stopped software TX queue before waiting for already-submitted hardware bytes. This prevents last close from waiting for the fixed 30-second close timeout on a queue that cannot drain. Add a DragonOS dunitest regression that queues serial output under TCOOFF and verifies last close completes promptly. Validation: - make fmt - make kernel - tty_termios: 21/21 passed in DragonOS - tty_tcflush: 6/6 passed in DragonOS - tty_pty_hangup: 36/36 passed in DragonOS - Python Ctrl+C twice produced KeyboardInterrupt without a kernel panic Signed-off-by: longjin <longjin@dragonos.org> --------- Signed-off-by: longjin <longjin@dragonos.org>