libkernel: poll throws for POLLPRI on guest sockets under WSAPoll (PSXS5, SwanStation, ProsperoTV after #3649); fix branch ready, PSXS5 renders #4478

Closed
opened 2026-10-12 13:04:12 +00:00 by screamm · 5 comments
screamm commented 2026-10-12 13:04:12 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T13:04:12Z.


With #3649 (poll on file descriptors) applied, three catalog titles stop on the next Windows limit in poll: what(): poll: POLLPRI is not supported by WSAPoll, thrown when a title polls a guest socket with POLLPRI|POLLOUT (a non-blocking connect completion check): PSXS5 (PPSA97510, socket 0x10000002, thread gamedb, at 13 s), SwanStation (PPSA98510, sockets 0x10000003/0x10000002, threads gamedb and update), ProsperoTV (PPSA99003, {0x10000001, POLLPRI|POLLOUT} at 5.3 s). Verbatim lines and gdb traces are in my #3649 validation comment.

Fix branch ready: screamm:fix/libkernel-poll-pollpri-sockets: 1a20b493 on top of #3649's two commits on main 58ee7af7 (depends on #3649; the fix commit alone is what needs carrying once #3649 lands). I cannot open it as a PR under the intake rule while #4081 is open; anyone eligible is welcome to carry it, keeping the commit as is.

  • FreeBSD 11.4 sopoll_generic (sys/kern/uipc_socket.c, 8c639945) treats POLLPRI and POLLRDBAND alike: both mean out-of-band data is pending. On Windows POLLPRI is now passed to WSAPoll as POLLRDBAND (WSAPoll rejects POLLPRI with WSAEINVAL; measured on this host: it reports POLLRDBAND once a peer sends MSG_OOB, wakes a waiting poll, and clears it when the byte is read with MSG_OOB, consistent with SIOCATMARK), and POLLIN is mapped to POLLRDNORM because Winsock's POLLIN includes POLLRDBAND and would otherwise report urgent data as readable, which FreeBSD does not. Linux is unchanged. select's exceptfds path already asks for POLLRDBAND through the libSceNet poller. Guest send/recv refuse MSG_OOB with EOPNOTSUPP, so urgent data can only come from an outside peer; the one remaining difference (Winsock keeps reporting urgent data until the byte is read with MSG_OOB, FreeBSD stops once the stream is read past the mark) replaces the old "POLLPRI throws" clause in TechnicalDebt.
  • guest_poll gains: a non-blocking connect polled with POLLPRI|POLLOUT reports exactly POLLOUT; a connected pair the same; MSG_OOB on guest sockets gives errno 45; after a host socket sends MSG_OOB, polling POLLPRI reports it and POLLIN|POLLPRI|POLLOUT gives POLLPRI|POLLOUT without POLLIN (Windows-only assertion, plus POLLRDBAND). Note for reviewers: non-blocking connect on Windows returns errno 35 where FreeBSD gives EINPROGRESS 36 (pre-existing, the test accepts either).

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_poll, guest_socket_pair, guest_udp, guest_sce_net 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 620/620; conventions and git diff --check pass. Titles relinked against this build (run 4 runtime, 60 s): PSXS5 runs the whole minute rendering (PSXS5 | FPS: 38.79 (1496) in the window title), SwanStation runs the whole minute with no stop (it exited 0xC0000409 before), ProsperoTV moves on to what(): fcntl: record locks are not implemented on Windows, command=12, fd=3 (#3840's recorded limit, fix in progress). Not run on Linux.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5814216404 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4478). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T13:04:12Z. --- With #3649 (poll on file descriptors) applied, three catalog titles stop on the next Windows limit in `poll`: `what(): poll: POLLPRI is not supported by WSAPoll`, thrown when a title polls a guest socket with `POLLPRI|POLLOUT` (a non-blocking `connect` completion check): PSXS5 (PPSA97510, socket `0x10000002`, thread gamedb, at 13 s), SwanStation (PPSA98510, sockets `0x10000003`/`0x10000002`, threads gamedb and update), ProsperoTV (PPSA99003, `{0x10000001, POLLPRI|POLLOUT}` at 5.3 s). Verbatim lines and gdb traces are in my #3649 validation comment. **Fix branch ready:** [`screamm:fix/libkernel-poll-pollpri-sockets`](https://github.com/screamm/AnyPS5/tree/fix/libkernel-poll-pollpri-sockets): `1a20b493` on top of #3649's two commits on `main` `58ee7af7` (depends on #3649; the fix commit alone is what needs carrying once #3649 lands). I cannot open it as a PR under the intake rule while #4081 is open; anyone eligible is welcome to carry it, keeping the commit as is. - FreeBSD 11.4 `sopoll_generic` (`sys/kern/uipc_socket.c`, `8c639945`) treats `POLLPRI` and `POLLRDBAND` alike: both mean out-of-band data is pending. On Windows `POLLPRI` is now passed to WSAPoll as `POLLRDBAND` (WSAPoll rejects `POLLPRI` with `WSAEINVAL`; measured on this host: it reports `POLLRDBAND` once a peer sends `MSG_OOB`, wakes a waiting poll, and clears it when the byte is read with `MSG_OOB`, consistent with `SIOCATMARK`), and `POLLIN` is mapped to `POLLRDNORM` because Winsock's `POLLIN` includes `POLLRDBAND` and would otherwise report urgent data as readable, which FreeBSD does not. Linux is unchanged. `select`'s exceptfds path already asks for `POLLRDBAND` through the libSceNet poller. Guest `send`/`recv` refuse `MSG_OOB` with `EOPNOTSUPP`, so urgent data can only come from an outside peer; the one remaining difference (Winsock keeps reporting urgent data until the byte is read with `MSG_OOB`, FreeBSD stops once the stream is read past the mark) replaces the old "POLLPRI throws" clause in TechnicalDebt. - `guest_poll` gains: a non-blocking `connect` polled with `POLLPRI|POLLOUT` reports exactly `POLLOUT`; a connected pair the same; `MSG_OOB` on guest sockets gives errno 45; after a host socket sends `MSG_OOB`, polling `POLLPRI` reports it and `POLLIN|POLLPRI|POLLOUT` gives `POLLPRI|POLLOUT` without `POLLIN` (Windows-only assertion, plus `POLLRDBAND`). Note for reviewers: non-blocking `connect` on Windows returns errno 35 where FreeBSD gives `EINPROGRESS` 36 (pre-existing, the test accepts either). **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_poll`, `guest_socket_pair`, `guest_udp`, `guest_sce_net` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 620/620; conventions and `git diff --check` pass. Titles relinked against this build (run 4 runtime, 60 s): PSXS5 runs the whole minute rendering (`PSXS5 | FPS: 38.79 (1496)` in the window title), SwanStation runs the whole minute with no stop (it exited 0xC0000409 before), ProsperoTV moves on to `what(): fcntl: record locks are not implemented on Windows, command=12, fd=3` (#3840's recorded limit, fix in progress). Not run on Linux. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
screamm commented 2026-10-12 13:31:52 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T13:31:52Z.


Combined run on Windows (main 33ae282e + #3649's two commits + the POLLPRI fix from #4478 + the record-lock fix from #4479, all cherry-picking cleanly; run 4 runtime with that build's libs and relinker, 60 s each): ProsperoRadio (PPSA99001) and ProsperoTV (PPSA99003) get past poll and the record locks and now stop on the graphics side, [videoout] presentation failed: AGC graphics: last provoking vertex with explicit per-vertex flat interpolation is unsupported (open #4030); PSXS5 (PPSA97510) runs the whole minute at PSXS5 | FPS: 59.93 (2867); SwanStation (PPSA98510) runs the whole minute (SwanStationPS5 ready, pad detected, its gamedb download fails with curl 7). No library stop is left in these four that lacks a PR. One observation for later: every HTTPS request from inside the guest fails immediately in these titles (Failed to connect to all.api.radio-browser.info port 443 after 75 ms, curl 7) while the same URLs answer from the host shell; it produces no stop line, and PSXS5 logged it before these fixes too.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125308967 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4478#issuecomment-6125308967). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T13:31:52Z. --- Combined run on Windows (`main` `33ae282e` + #3649's two commits + the POLLPRI fix from #4478 + the record-lock fix from #4479, all cherry-picking cleanly; run 4 runtime with that build's libs and relinker, 60 s each): ProsperoRadio (PPSA99001) and ProsperoTV (PPSA99003) get past `poll` and the record locks and now stop on the graphics side, `[videoout] presentation failed: AGC graphics: last provoking vertex with explicit per-vertex flat interpolation is unsupported` (open #4030); PSXS5 (PPSA97510) runs the whole minute at `PSXS5 | FPS: 59.93 (2867)`; SwanStation (PPSA98510) runs the whole minute (`SwanStationPS5 ready`, pad detected, its gamedb download fails with curl 7). No library stop is left in these four that lacks a PR. One observation for later: every HTTPS request from inside the guest fails immediately in these titles (`Failed to connect to all.api.radio-browser.info port 443 after 75 ms`, `curl 7`) while the same URLs answer from the host shell; it produces no stop line, and PSXS5 logged it before these fixes too.
LeandroLP23 commented 2026-10-13 13:23:40 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T13:23:40Z.


This looks fixed: #4525 (POLLPRI on Windows sockets) merged on 2026-10-13. It names this issue only as its evidence, not with a closing keyword, so this stayed open. I verified the three titles on #4525 before the merge: PSXS5, SwanStation and ProsperoTV get past the poll stop. Could a maintainer close it?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6146558426 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4478#issuecomment-6146558426). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T13:23:40Z. --- This looks fixed: #4525 (POLLPRI on Windows sockets) merged on 2026-10-13. It names this issue only as its evidence, not with a closing keyword, so this stayed open. I verified the three titles on #4525 before the merge: PSXS5, SwanStation and ProsperoTV get past the `poll` stop. Could a maintainer close it?
LeandroLP23 commented 2026-10-13 14:09:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T14:09:08Z.


PSXS5 (PPSA97510) reaches Menus on main: Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release, main 6cd052848 with no patches, catalog release relinked with --windows --trap-sdk-syscall-stubs, 60 s with APS5_PAD_INPUT_FILE pulses from 30 s, frames dumped with APS5_DUMP_FRAMES. It draws its library screen ("Your shelf is empty", "All games 0") at 60 FPS, and it responds to the controller: the R1/Options pulses bring up the "Sorted by Recently played" toast.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6147457790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4478#issuecomment-6147457790). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T14:09:08Z. --- PSXS5 (PPSA97510) reaches **Menus** on `main`: Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release, `main` `6cd052848` with no patches, catalog release relinked with `--windows --trap-sdk-syscall-stubs`, 60 s with `APS5_PAD_INPUT_FILE` pulses from 30 s, frames dumped with `APS5_DUMP_FRAMES`. It draws its library screen ("Your shelf is empty", "All games 0") at 60 FPS, and it responds to the controller: the R1/Options pulses bring up the "Sorted by Recently played" toast.
LeandroLP23 commented 2026-10-13 14:09:09 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-13T14:09:09Z.


SwanStationPS5 (PPSA98510) reaches Menus on main: Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release, main 6cd052848 with no patches, catalog release relinked with --windows --trap-sdk-syscall-stubs, 60 s with APS5_PAD_INPUT_FILE pulses from 30 s, frames dumped with APS5_DUMP_FRAMES. It draws its library screen ("Your shelf is empty", "All games 0") at about 35 FPS, and it responds to the controller: the R1/Options pulses bring up the "Sorted by Recently played" toast.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6147458326 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4478#issuecomment-6147458326). Originally posted by [LeandroLP23](https://github.com/LeandroLP23) on 2026-10-13T14:09:09Z. --- SwanStationPS5 (PPSA98510) reaches **Menus** on `main`: Windows 11 (26300), Radeon 860M, WinLibs GCC 15.2.0, Release, `main` `6cd052848` with no patches, catalog release relinked with `--windows --trap-sdk-syscall-stubs`, 60 s with `APS5_PAD_INPUT_FILE` pulses from 30 s, frames dumped with `APS5_DUMP_FRAMES`. It draws its library screen ("Your shelf is empty", "All games 0") at about 35 FPS, and it responds to the controller: the R1/Options pulses bring up the "Sorted by Recently played" toast.
oneandonlydean commented 2026-10-14 00:08:45 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:08:45Z.


Closing: #4525 is on main, and PSXS5, SwanStation and ProsperoTV get past the poll stop. Comment here if a title still hits POLLPRI is not supported by WSAPoll on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157870667 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4478#issuecomment-6157870667). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T00:08:45Z. --- Closing: #4525 is on main, and PSXS5, SwanStation and ProsperoTV get past the `poll` stop. Comment here if a title still hits `POLLPRI is not supported by WSAPoll` on current main.
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#4478
No description provided.