libkernel: tcsendbreak, tcdrain, tcflush, tcflow, tcgetpgrp and tcsetpgrp are absent (PS5MC, XPSemu); fix branch ready #3723

Closed
opened 2026-10-11 16:00:00 +00:00 by screamm · 0 comments
screamm commented 2026-10-11 16:00:00 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T16:00:00Z.


libkernel lacks tcsendbreak (vXE-dIUIZlE), tcdrain (brGGJWsZauw), tcflush (FxHW5NuEXsY), tcflow (OG8xRaGIpqk), tcgetpgrp (5OEl1mRhUm0) and tcsetpgrp (YMuesZTyTl4). From the relink registry order they are the next predicted stops of PS5MC (PPSA99420, indices 442 onward and 462/463) and XPSemu (PPSA97358, index 214, its first uncovered import); not yet observed in a run.

Fix branch ready: screamm:feat/libkernel-termios-calls (d4625e23, one commit on main a11c8f7f). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.

  • All six follow the merged tcgetattr precedent in Terminal.cpp: EBADF for a closed descriptor, ENOTTY for a file or pipe, the socket errors tcgetattr already gives (EADDRNOTAVAIL for AF_INET, EOPNOTSUPP otherwise), per FreeBSD 11.4 lib/libc/gen/termios.c over the per-descriptor ioctl handlers (sys_generic.c, sys_socket.c, vfs_vnops.c, sys_pipe.c, in.c/in6.c, 8c639945). tcflush returns EINVAL for a queue outside 1..3 and tcflow for an action outside 1..4 before the descriptor check, as the libc source orders it; tcsendbreak's 0.4 s pause is never reached because its first ioctl fails.
  • One deliberate departure from "ENOTTY everywhere": FreeBSD's pipe handler answers TIOCGPGRP/TIOCSPGRP with the pipe's signal owner, which is not modelled, so tcgetpgrp/tcsetpgrp throw on a guest pipe above descriptor 2 instead of returning ENOTTY (descriptors 0 to 2 keep the tcgetattr treatment). Recorded in TechnicalDebt.
  • guest_terminal covers each call over stdin/stdout/stderr, a file, both pipe ends and an AF_INET socket, the EINVAL cases (on a file and on -1) and EBADF for -1 and closed descriptors of each kind.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_terminal 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 532/536, the failures being the known windows_exceptions (#3411, fixed by #3415), guest_kernel_sys (#3510), guest_filesystem (#3518) and the agc_driver flake (#3171); with main's Terminal.cpp the extended test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5802704526 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3723). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T16:00:00Z. --- libkernel lacks `tcsendbreak` (`vXE-dIUIZlE`), `tcdrain` (`brGGJWsZauw`), `tcflush` (`FxHW5NuEXsY`), `tcflow` (`OG8xRaGIpqk`), `tcgetpgrp` (`5OEl1mRhUm0`) and `tcsetpgrp` (`YMuesZTyTl4`). From the relink registry order they are the next predicted stops of PS5MC (PPSA99420, indices 442 onward and 462/463) and XPSemu (PPSA97358, index 214, its first uncovered import); not yet observed in a run. **Fix branch ready:** [`screamm:feat/libkernel-termios-calls`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-termios-calls) (`d4625e23`, one commit on `main` `a11c8f7f`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. - All six follow the merged `tcgetattr` precedent in `Terminal.cpp`: `EBADF` for a closed descriptor, `ENOTTY` for a file or pipe, the socket errors `tcgetattr` already gives (`EADDRNOTAVAIL` for `AF_INET`, `EOPNOTSUPP` otherwise), per FreeBSD 11.4 `lib/libc/gen/termios.c` over the per-descriptor ioctl handlers (`sys_generic.c`, `sys_socket.c`, `vfs_vnops.c`, `sys_pipe.c`, `in.c`/`in6.c`, `8c639945`). `tcflush` returns `EINVAL` for a queue outside 1..3 and `tcflow` for an action outside 1..4 before the descriptor check, as the libc source orders it; `tcsendbreak`'s 0.4 s pause is never reached because its first ioctl fails. - One deliberate departure from "ENOTTY everywhere": FreeBSD's pipe handler answers `TIOCGPGRP`/`TIOCSPGRP` with the pipe's signal owner, which is not modelled, so `tcgetpgrp`/`tcsetpgrp` throw on a guest pipe above descriptor 2 instead of returning `ENOTTY` (descriptors 0 to 2 keep the `tcgetattr` treatment). Recorded in TechnicalDebt. - `guest_terminal` covers each call over stdin/stdout/stderr, a file, both pipe ends and an `AF_INET` socket, the `EINVAL` cases (on a file and on -1) and `EBADF` for -1 and closed descriptors of each kind. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_terminal` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 532/536, the failures being the known `windows_exceptions` (#3411, fixed by #3415), `guest_kernel_sys` (#3510), `guest_filesystem` (#3518) and the `agc_driver` flake (#3171); with `main`'s `Terminal.cpp` the extended test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#3723
No description provided.