Summary
Complete TTY termios-related ioctl handling so that tcsetattr() and legacy termio paths behave like Linux 6.6.
Observed behavior
During apt install, user space reports:
E: Setting in Start via TCSAFLUSH for stdin failed! - tcsetattr (25: Inappropriate ioctl for device)
This corresponds to tcsetattr(fd, TCSAFLUSH, ...) → ioctl(TCSETSF).
Root cause
In kernel/src/driver/tty/tty_core.rs, tty_mode_ioctl() currently handles only:
TCGETS
TCSETS (TCSANOW)
TCSETSW (TCSADRAIN)
The following ioctls are defined but not wired; requests hit the default branch (ENOIOCTLCMD), which surfaces to user space as ENOTTY:
| ioctl |
value |
typical user API |
TCSETSF |
0x5404 |
tcsetattr(..., TCSAFLUSH) |
TCSETA |
0x5406 |
tcsetattr (struct termio) |
TCSETAW |
0x5407 |
same + drain |
TCSETAF |
0x5408 |
same + flush |
Expected behavior
Align with Linux 6.6 TTY termios ioctl semantics, including flush-before-set for TCSETSF / TCSETAF and correct handling of struct termio for the TCSETA* family.
Acceptance criteria
Summary
Complete TTY termios-related
ioctlhandling so thattcsetattr()and legacytermiopaths behave like Linux 6.6.Observed behavior
During
apt install, user space reports:This corresponds to
tcsetattr(fd, TCSAFLUSH, ...)→ioctl(TCSETSF).Root cause
In
kernel/src/driver/tty/tty_core.rs,tty_mode_ioctl()currently handles only:TCGETSTCSETS(TCSANOW)TCSETSW(TCSADRAIN)The following ioctls are defined but not wired; requests hit the default branch (
ENOIOCTLCMD), which surfaces to user space asENOTTY:TCSETSF0x5404tcsetattr(..., TCSAFLUSH)TCSETA0x5406tcsetattr(struct termio)TCSETAW0x5407TCSETAF0x5408Expected behavior
Align with Linux 6.6 TTY termios ioctl semantics, including flush-before-set for
TCSETSF/TCSETAFand correct handling ofstruct termiofor theTCSETA*family.Acceptance criteria
tcsetattr(0, TCSAFLUSH, &t)succeeds on a serial console (nographic) shellapt install(except whenstdinis legitimately not a TTY)TCSETA/TCSETAW/TCSETAFdo not returnENOTTYon a valid TTY fdc_unitest(e.g. extend existing TTY tests such astest_tty_tcflush.c)