feat(libkernel): poll on file descriptors and Windows pipe read ends #3649

Closed
pushkarreddyy wants to merge 2 commits from upstream-pr/3649 into main
pushkarreddyy commented 2026-10-11 14:44:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T14:44:32Z.


What

libkernel's poll() previously threw for any descriptor below the socket range (0x10000000) with poll: descriptor X is not a socket.

This PR carries @screamm's fix from screamm:feat/libkernel-poll-files (commits c50ac7856 and e8d123804, authorship preserved) rebased cleanly onto current main:

  • Regular files, directories, and anonymous shared memory objects report requested POLLIN, POLLRDNORM, and POLLOUT immediately (following FreeBSD 11 vop_stdpoll and poll_no_poll).
  • Closed descriptors report POLLNVAL; POLLHUP clears POLLOUT (pollscan).
  • On Linux, pipes, terminals, and character devices use host poll.
  • On Windows, pipe() records descriptor ends (File/src/PipeEnd.cpp, tracked across dup, dup2, close, sceKernelClose); read ends answer via PeekNamedPipe (POLLIN/POLLRDNORM with buffered bytes, and POLLIN|POLLRDNORM|POLLHUP on ERROR_BROKEN_PIPE).
  • Mixed arrays containing both sockets and host descriptors check ready descriptors immediately and slice socket waits into 100 ms intervals.
  • Arrays exceeding 1024 descriptors throw.

Fixes #3521.

Tested

  • ProsperoTV (PPSA99003): Unblocks startup stop on descriptor 3; advances to menu ([TV] menu ready display=3840x2160) and runs past 60 s.
  • PSXS5 (PPSA97510 2.2.0): Directly resolves the 31-second runtime stop reported by @orishamir in #3494 (what(): poll: descriptor 6 is not a socket (#3521)).
  • Unit tests: guest_poll covers file POLLIN|POLLOUT, file + idle UDP socket returning 1 immediately, closed file POLLNVAL, >1024 descriptors throwing, empty pipe read end, pipe read end ready after write, POLLHUP after writer close, and write-end cases.
  • Tested on Windows 11 MinGW-w64 GCC 15.2.0 Release and verified with python tools/check_conventions.py --base origin/main (0 comments in source).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA99003 #1578
  • AI-assisted: yes (Claude Code)
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4819877141 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T14:44:32Z. --- ### What `libkernel`'s `poll()` previously threw for any descriptor below the socket range (`0x10000000`) with `poll: descriptor X is not a socket`. This PR carries @screamm's fix from [`screamm:feat/libkernel-poll-files`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-poll-files) (commits `c50ac7856` and `e8d123804`, authorship preserved) rebased cleanly onto current `main`: - Regular files, directories, and anonymous shared memory objects report requested `POLLIN`, `POLLRDNORM`, and `POLLOUT` immediately (following FreeBSD 11 `vop_stdpoll` and `poll_no_poll`). - Closed descriptors report `POLLNVAL`; `POLLHUP` clears `POLLOUT` (`pollscan`). - On Linux, pipes, terminals, and character devices use host `poll`. - On Windows, `pipe()` records descriptor ends (`File/src/PipeEnd.cpp`, tracked across `dup`, `dup2`, `close`, `sceKernelClose`); read ends answer via `PeekNamedPipe` (`POLLIN`/`POLLRDNORM` with buffered bytes, and `POLLIN|POLLRDNORM|POLLHUP` on `ERROR_BROKEN_PIPE`). - Mixed arrays containing both sockets and host descriptors check ready descriptors immediately and slice socket waits into 100 ms intervals. - Arrays exceeding 1024 descriptors throw. Fixes #3521. ### Tested - **ProsperoTV (PPSA99003)**: Unblocks startup stop on descriptor 3; advances to menu (`[TV] menu ready display=3840x2160`) and runs past 60 s. - **PSXS5 (PPSA97510 2.2.0)**: Directly resolves the 31-second runtime stop reported by @orishamir in #3494 (`what(): poll: descriptor 6 is not a socket (#3521)`). - **Unit tests**: `guest_poll` covers file `POLLIN|POLLOUT`, file + idle UDP socket returning 1 immediately, closed file `POLLNVAL`, >1024 descriptors throwing, empty pipe read end, pipe read end ready after write, `POLLHUP` after writer close, and write-end cases. - Tested on Windows 11 MinGW-w64 GCC 15.2.0 Release and verified with `python tools/check_conventions.py --base origin/main` (0 comments in source). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99003 #1578 - [x] AI-assisted: yes (Claude Code)
blawesom commented 2026-10-11 14:59:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T14:59:55Z.


Cross-linking for the review: this implements the fix tracked in #3521, which has an independent Linux verification on that issue — full suite 832/832 (CachyOS, kernel 7.2.9, GCC 16.2.1, including every Vulkan test on AMD RX 9070 XT / RADV), conventions check clean, rebased onto current main at the time. The Windows pipe read-end paths of this change are the part that could not be exercised there, so the report's Windows-side coverage complements it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110336449 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6110336449). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T14:59:55Z. --- Cross-linking for the review: this implements the fix tracked in #3521, which has an independent Linux verification on that issue — full suite **832/832** (CachyOS, kernel 7.2.9, GCC 16.2.1, including every Vulkan test on AMD RX 9070 XT / RADV), conventions check clean, rebased onto current `main` at the time. The Windows pipe read-end paths of this change are the part that could not be exercised there, so the report's Windows-side coverage complements it.
screamm commented 2026-10-11 15:24:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-11T15:24:45Z.


Windows validation of e8d12380 merged onto main a11c8f7f (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs): the poll test passes 3/3 with --repeat until-fail:3; ctest -j8 -E "^agc_driver_|^video_out_flip" 531/536, the failures being the known windows_exceptions (#3411, fixed by #3415), guest_kernel_sys (#3510), guest_filesystem (#3518) and the load flakes agc_driver (#3171) and guest_ampr_markers (#3371). Same result as the original branch in #3521. Thanks for carrying it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110563446 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6110563446). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T15:24:45Z. --- Windows validation of `e8d12380` merged onto `main` `a11c8f7f` (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`): the poll test passes 3/3 with `--repeat until-fail:3`; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 531/536, the failures being the known `windows_exceptions` (#3411, fixed by #3415), `guest_kernel_sys` (#3510), `guest_filesystem` (#3518) and the load flakes `agc_driver` (#3171) and `guest_ampr_markers` (#3371). Same result as the original branch in #3521. Thanks for carrying it.
pushkarreddyy commented 2026-10-11 15:55:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T15:55:17Z.


Calling on @adriadam10 for review when convenient:

Both platform verifications are complete for this carry of #3521:

  • Linux: full suite 832/832 verified by @blawesom (CachyOS / GCC / RADV).
  • Windows 11: verified 3/3 repeat poll passes and full libs suite 531/536 by original author @screamm.
  • All CI checks passing and conventions clean. Ready for merge!
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6110842122 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6110842122). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T15:55:17Z. --- Calling on @adriadam10 for review when convenient: Both platform verifications are complete for this carry of #3521: - Linux: full suite **832/832** verified by @blawesom (CachyOS / GCC / RADV). - Windows 11: verified 3/3 repeat poll passes and full libs suite 531/536 by original author @screamm. - All CI checks passing and conventions clean. Ready for merge!
blawesom commented 2026-10-11 17:19:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T17:19:07Z.


Cross-reference: #3644 implements the same fix (poll on pipe descriptors, tracked in #3521).

CONTRIBUTING.md asks authors to "check that no open pull request already implements the same functions" before starting — both PRs are open, so flagging for the maintainers.

The limitation this creates: only one of the two can be merged; the other gets closed as duplicate, and both currently cost review time in a 340+ queue.

Evidence to help the choice (independent pre-review, Linux — CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON):

  • both pass the full local suite (832/832 each; #3644 had one transient single-test flake that did not recur);
  • both are based on current main;
  • I see no functional difference from the diffs — both are legitimate implementations of the same fix.

If it helps, either author can rebase onto the other or close their own; the choice is the maintainers'.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111623163 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6111623163). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T17:19:07Z. --- **Cross-reference: #3644 implements the same fix** (poll on pipe descriptors, tracked in #3521). CONTRIBUTING.md asks authors to "check that no open pull request already implements the same functions" before starting — both PRs are open, so flagging for the maintainers. **The limitation this creates:** only one of the two can be merged; the other gets closed as duplicate, and both currently cost review time in a 340+ queue. Evidence to help the choice (independent pre-review, Linux — CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`): - both pass the full local suite (832/832 each; #3644 had one transient single-test flake that did not recur); - both are based on current `main`; - I see no functional difference from the diffs — both are legitimate implementations of the same fix. If it helps, either author can rebase onto the other or close their own; the choice is the maintainers'.
babyhuey commented 2026-10-11 20:09:00 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T20:09:00Z.


Verified this PR on both OSes with a title that needs it: ProsperoTV (PPSA99003, catalog 01.000.060).

Without this PR, but with openat from #3968 so the title loads, it opens its TV menu and then aborts in poll right after opening /dev/crypto:

  • Linux: poll: descriptor 6 is not a socket

With this PR stacked on #3968 (local merge of c50ac785/e8d12380, clean):

  • Linux: no more stops before the headless window. It reaches Vulkan device ready, then DisplayWindow throws because the runner has no display.
  • Windows 11 (MinGW GCC 15.2): it renders, and later stops at the separate AGC gap last provoking vertex with explicit per-vertex flat interpolation is unsupported (#3581).
  • guest_poll and guest_kernel_sys pass 5/5 (--repeat until-fail:5) on Windows, with 0 warnings.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6113210436 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6113210436). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T20:09:00Z. --- Verified this PR on both OSes with a title that needs it: ProsperoTV (PPSA99003, catalog 01.000.060). Without this PR, but with `openat` from #3968 so the title loads, it opens its TV menu and then aborts in `poll` right after opening `/dev/crypto`: - Linux: `poll: descriptor 6 is not a socket` With this PR stacked on #3968 (local merge of c50ac785/e8d12380, clean): - Linux: no more stops before the headless window. It reaches `Vulkan device ready`, then `DisplayWindow` throws because the runner has no display. - Windows 11 (MinGW GCC 15.2): it renders, and later stops at the separate AGC gap `last provoking vertex with explicit per-vertex flat interpolation is unsupported` (#3581). - `guest_poll` and `guest_kernel_sys` pass 5/5 (`--repeat until-fail:5`) on Windows, with 0 warnings.
screamm commented 2026-10-12 00:36:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T00:36:34Z.


Heads-up from a Windows validation attempt: e8d12380 no longer merges onto main (bab7b328/bca7a29d). The only conflict is docs/dev/TechnicalDebt.md: #3592 (d694aac7) added a "Socket error numbers" bullet right after the poll bullet this PR rewrites; the code files merge cleanly, and the obvious resolution is to keep this PR's poll bullet followed by main's new bullet. #3644 has the same conflict. It now blocks more titles: with #3494 applied, PSXS5 (PPSA97510) also stops at what(): poll: descriptor 6 is not a socket, in addition to ProsperoTV (PPSA99003) and ProsperoRadio (PPSA99001) from the third catalog run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115677600 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6115677600). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T00:36:34Z. --- Heads-up from a Windows validation attempt: `e8d12380` no longer merges onto `main` (`bab7b328`/`bca7a29d`). The only conflict is `docs/dev/TechnicalDebt.md`: #3592 (`d694aac7`) added a "Socket error numbers" bullet right after the `poll` bullet this PR rewrites; the code files merge cleanly, and the obvious resolution is to keep this PR's `poll` bullet followed by `main`'s new bullet. #3644 has the same conflict. It now blocks more titles: with #3494 applied, PSXS5 (PPSA97510) also stops at `what(): poll: descriptor 6 is not a socket`, in addition to ProsperoTV (PPSA99003) and ProsperoRadio (PPSA99001) from the third catalog run.
pushkarreddyy commented 2026-10-12 02:06:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T02:06:35Z.


Hi @screamm and @adriadam10,

Thank you for the heads-up and validation on Windows!

The requested rebase onto latest origin/main (d371ed307) is now complete on commit 5bf212852:

  • Cleanly resolved the docs/dev/TechnicalDebt.md conflict by placing this PR's poll bullet followed by main's #3592 Socket error numbers bullet as suggested.
  • C++ source files apply cleanly with 0 comments and pass ools/check_conventions.py --base origin/main.
  • Unblocks PSXS5 (PPSA97510), ProsperoTV (PPSA99003), and ProsperoRadio (PPSA99001) from poll: descriptor N is not a socket.

Ready for review and merge. Thank you!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6116469300 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6116469300). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T02:06:35Z. --- Hi @screamm and @adriadam10, Thank you for the heads-up and validation on Windows! The requested rebase onto latest origin/main (d371ed307) is now complete on commit 5bf212852: - Cleanly resolved the docs/dev/TechnicalDebt.md conflict by placing this PR's poll bullet followed by main's #3592 Socket error numbers bullet as suggested. - C++ source files apply cleanly with 0 comments and pass ools/check_conventions.py --base origin/main. - Unblocks **PSXS5** (PPSA97510), **ProsperoTV** (PPSA99003), and **ProsperoRadio** (PPSA99001) from poll: descriptor N is not a socket. Ready for review and merge. Thank you!
screamm commented 2026-10-12 06:23:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T06:23:17Z.


Heads-up from a Windows validation attempt on the rebased head: 5dbe3637 (base 6253883d) no longer merges onto main 2ccbd376. The only conflict is Stdio.cpp in close_nid_postfix, with #3923 (merged as 5fe4bebe): this PR has File::ForgetPipeEnd(d); return _close(d); where main now has return WithoutParameterHandler([d] { return ::_close(d); });. The resolution is to keep File::ForgetPipeEnd(d); followed by main's WithoutParameterHandler return. Udp.cpp and TechnicalDebt.md merge cleanly. I'll rerun the Windows build, guest_poll 3/3, the suite and PSXS5/ProsperoTV/ProsperoRadio once it is rebased.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118929061 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6118929061). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T06:23:17Z. --- Heads-up from a Windows validation attempt on the rebased head: `5dbe3637` (base `6253883d`) no longer merges onto `main` `2ccbd376`. The only conflict is `Stdio.cpp` in `close_nid_postfix`, with #3923 (merged as `5fe4bebe`): this PR has `File::ForgetPipeEnd(d); return _close(d);` where `main` now has `return WithoutParameterHandler([d] { return ::_close(d); });`. The resolution is to keep `File::ForgetPipeEnd(d);` followed by `main`'s `WithoutParameterHandler` return. `Udp.cpp` and `TechnicalDebt.md` merge cleanly. I'll rerun the Windows build, `guest_poll` 3/3, the suite and PSXS5/ProsperoTV/ProsperoRadio once it is rebased.
pushkarreddyy commented 2026-10-12 06:36:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T06:36:47Z.


Hi @screamm,

Thank you for the heads-up!

The rebase onto latest \origin/main\ (\2ccbd376f) is complete on commit \16820c49:

  • Resolved the \Stdio.cpp\ conflict in \close_nid_postfix\ exactly as requested: kept \File::ForgetPipeEnd(d);\ followed by \main's \WithoutParameterHandler\ return.
  • \ ools/check_conventions.py --base origin/main\ passes cleanly with 0 comments.
  • Ready for your Windows rerun on \guest_poll\ 3/3, the test suite, and PSXS5 / ProsperoTV / ProsperoRadio. Thank you!
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6119088143 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6119088143). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T06:36:47Z. --- Hi @screamm, Thank you for the heads-up! The rebase onto latest \origin/main\ (\2ccbd376f\) is complete on commit \16820c49\: - Resolved the \Stdio.cpp\ conflict in \close_nid_postfix\ exactly as requested: kept \File::ForgetPipeEnd(d);\ followed by \main\'s \WithoutParameterHandler\ return. - \ ools/check_conventions.py --base origin/main\ passes cleanly with 0 comments. - Ready for your Windows rerun on \guest_poll\ 3/3, the test suite, and *PSXS5* / *ProsperoTV* / *ProsperoRadio*. Thank you!
pushkarreddyy commented 2026-10-12 11:48:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T11:48:50Z.


Hi @adriadam10 and @screamm,

Cleanly rebased onto latest origin/main ( fa198407) on commit 1c369185d:

  • Resolved the CMakeLists.txt and Stdio.cpp conflicts with merged #3840 (DescriptorControl.cpp / File::RememberDescriptor / File::ShareDescriptor), preserving both descriptor tracking and Windows pipe-end tracking.
  • ools/check_conventions.py --base origin/main passes with zero comments.
  • Both platform verifications are complete (Linux 832/832 by @blawesom; Windows 11 by @babyhuey and @screamm with ProsperoTV PPSA99003 unblocked).

Ready for final review and merge! Thank you!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123659175 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6123659175). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T11:48:50Z. --- Hi @adriadam10 and @screamm, Cleanly rebased onto latest origin/main ( fa198407) on commit 1c369185d: - Resolved the CMakeLists.txt and Stdio.cpp conflicts with merged #3840 (DescriptorControl.cpp / File::RememberDescriptor / File::ShareDescriptor), preserving both descriptor tracking and Windows pipe-end tracking. - ools/check_conventions.py --base origin/main passes with zero comments. - Both platform verifications are complete (Linux 832/832 by @blawesom; Windows 11 by @babyhuey and @screamm with *ProsperoTV* PPSA99003 unblocked). Ready for final review and merge! Thank you!
screamm commented 2026-10-12 11:51:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T11:51:49Z.


Heads-up: b16820c4 conflicts again with current main 3d8ffeb2, this time with #3840 (5f3b94cb, fcntl on non-socket descriptors): libkernel/CMakeLists.txt (this PR adds File/src/DescriptorPoll.cpp, main adds File/src/DescriptorControl.cpp on the same line; both stay) and Stdio.cpp in pipe_nid_postfix (this PR's File::RememberPipeEnd(native[0|1], ...) next to main's File::RememberDescriptor(native[0|1], 0)) and dup2_nid_postfix (this PR's FindPipeEnd/RememberPipeEnd/ForgetPipeEnd next to main's File::ShareDescriptor(from, to)); both sides are needed in both places. Since both branches are mine, I'm preparing the resolved rebase with a Windows build, guest_poll and the four title runs (PSXS5, SwanStation, ProsperoTV, ProsperoRadio) and will post the commits here for @pushkarreddyy to take.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123703050 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6123703050). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T11:51:49Z. --- Heads-up: `b16820c4` conflicts again with current `main` `3d8ffeb2`, this time with #3840 (`5f3b94cb`, fcntl on non-socket descriptors): `libkernel/CMakeLists.txt` (this PR adds `File/src/DescriptorPoll.cpp`, `main` adds `File/src/DescriptorControl.cpp` on the same line; both stay) and `Stdio.cpp` in `pipe_nid_postfix` (this PR's `File::RememberPipeEnd(native[0|1], ...)` next to `main`'s `File::RememberDescriptor(native[0|1], 0)`) and `dup2_nid_postfix` (this PR's `FindPipeEnd`/`RememberPipeEnd`/`ForgetPipeEnd` next to `main`'s `File::ShareDescriptor(from, to)`); both sides are needed in both places. Since both branches are mine, I'm preparing the resolved rebase with a Windows build, `guest_poll` and the four title runs (PSXS5, SwanStation, ProsperoTV, ProsperoRadio) and will post the commits here for @pushkarreddyy to take.
pushkarreddyy commented 2026-10-12 12:02:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T12:02:51Z.


Hi @screamm,

Thank you very much for the heads-up and for detailing the resolution points with #3840!

The rebase onto latest origin/main (ffa198407) is already complete and pushed on HEAD (4b1b35864), resolving the conflict with #3840 exactly as you described:

  • CMakeLists.txt: Retained both DescriptorControl.cpp and DescriptorPoll.cpp.
  • Stdio.cpp (pipe_nid_postfix): Kept File::RememberDescriptor(native[0|1], 0) alongside File::RememberPipeEnd.
  • Stdio.cpp (close_nid_postfix): Kept File::ForgetPipeEnd(d) alongside WithoutParameterHandler([d] { return ::_close(d); }).
  • Stdio.cpp (dup2_nid_postfix): Kept File::ShareDescriptor(from, to) alongside pipe-end tracking (FindPipeEnd/RememberPipeEnd/ForgetPipeEnd).

Authorship on both commits (06ddffb29 and 4b1b35864) is preserved (David <[email protected]>), and tools/check_conventions.py --base origin/main passes cleanly with zero comments.

The branch is ready for your Windows validation run with guest_poll and the four titles (PSXS5, SwanStation, ProsperoTV, ProsperoRadio). Thank you!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6123878743 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6123878743). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T12:02:51Z. --- Hi @screamm, Thank you very much for the heads-up and for detailing the resolution points with #3840! The rebase onto latest `origin/main` (`ffa198407`) is already complete and pushed on HEAD (`4b1b35864`), resolving the conflict with #3840 exactly as you described: - **`CMakeLists.txt`**: Retained both `DescriptorControl.cpp` and `DescriptorPoll.cpp`. - **`Stdio.cpp` (`pipe_nid_postfix`)**: Kept `File::RememberDescriptor(native[0|1], 0)` alongside `File::RememberPipeEnd`. - **`Stdio.cpp` (`close_nid_postfix`)**: Kept `File::ForgetPipeEnd(d)` alongside `WithoutParameterHandler([d] { return ::_close(d); })`. - **`Stdio.cpp` (`dup2_nid_postfix`)**: Kept `File::ShareDescriptor(from, to)` alongside pipe-end tracking (`FindPipeEnd`/`RememberPipeEnd`/`ForgetPipeEnd`). Authorship on both commits (`06ddffb29` and `4b1b35864`) is preserved (`David <[email protected]>`), and `tools/check_conventions.py --base origin/main` passes cleanly with zero comments. The branch is ready for your Windows validation run with `guest_poll` and the four titles (*PSXS5*, *SwanStation*, *ProsperoTV*, *ProsperoRadio*). Thank you!
screamm commented 2026-10-12 12:26:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T12:26:49Z.


Windows validation of the rebased head 1c369185 on main ffa19840 (my own rebase of the same two commits has identical file contents, so I validated that; Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON, full build including libs): guest_poll, guest_kernel_fcntl, guest_dup, guest_socket_pair, guest_terminal 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 604/606, the two being audio_out2_timing (load-sensitive, #4347) and guest_sce_net (timer-resolution check in CheckEmptyEpoll, unrelated to poll), both passing serially (40/40); conventions and git diff --check pass. The pipe-end table and #3840's descriptor table stay in step across close, sceKernelClose, dup, dup2 and F_DUPFD.

Titles relinked against this build (run 4 runtime, libs and relinker from this build), all four get past the poll-on-a-pipe stop:

Title Before (main) After
PSXS5 (PPSA97510) what(): poll: descriptor 6 is not a socket at 42 s pipes 6/8/10/12 poll fine; at 13 s what(): poll: POLLPRI is not supported by WSAPoll on guest socket 0x10000002 with events `POLLPRI
SwanStation (PPSA98510) poll: descriptor 7 is not a socket same POLLPRI throw on sockets 0x10000003/0x10000002 (threads gamedb, update) at 12.7 s
ProsperoTV (PPSA99003) what(): poll: descriptor 3 is not a socket {3, POLLIN}, {5, POLLIN}+{3, POLLIN}, {0x10000001, POLLOUT}+{3, POLLIN} pass, then `{0x10000001, POLLPRI
ProsperoRadio (PPSA99001) what(): poll: descriptor 3 is not a socket at 44 s what(): fcntl: record locks are not implemented on Windows, command=12, fd=3 at 33.7 s (#3840's recorded Windows limit)

So the PR removes the current stop of all four titles; the next stops are the existing Windows limits for POLLPRI on a guest socket (a non-blocking connect check, three titles) and F_SETLK record locks (ProsperoRadio), which I'm taking up next. One request for the rebase: the two commits still carry the placeholder author David <[email protected]> from the original branch; git rebase --exec 'git commit --amend --author="screamm <[email protected]>" --no-edit' over the two would attribute them correctly.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124241280 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6124241280). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T12:26:49Z. --- Windows validation of the rebased head `1c369185` on `main` `ffa19840` (my own rebase of the same two commits has identical file contents, so I validated that; Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`, full build including `libs`): `guest_poll`, `guest_kernel_fcntl`, `guest_dup`, `guest_socket_pair`, `guest_terminal` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 604/606, the two being `audio_out2_timing` (load-sensitive, #4347) and `guest_sce_net` (timer-resolution check in `CheckEmptyEpoll`, unrelated to `poll`), both passing serially (40/40); conventions and `git diff --check` pass. The pipe-end table and #3840's descriptor table stay in step across `close`, `sceKernelClose`, `dup`, `dup2` and `F_DUPFD`. Titles relinked against this build (run 4 runtime, libs and relinker from this build), all four get past the `poll`-on-a-pipe stop: | Title | Before (`main`) | After | |---|---|---| | PSXS5 (PPSA97510) | `what(): poll: descriptor 6 is not a socket` at 42 s | pipes 6/8/10/12 poll fine; at 13 s `what(): poll: POLLPRI is not supported by WSAPoll` on guest socket `0x10000002` with events `POLLPRI|POLLOUT` (thread gamedb) | | SwanStation (PPSA98510) | `poll: descriptor 7 is not a socket` | same `POLLPRI` throw on sockets `0x10000003`/`0x10000002` (threads gamedb, update) at 12.7 s | | ProsperoTV (PPSA99003) | `what(): poll: descriptor 3 is not a socket` | `{3, POLLIN}`, `{5, POLLIN}+{3, POLLIN}`, `{0x10000001, POLLOUT}+{3, POLLIN}` pass, then `{0x10000001, POLLPRI|POLLOUT}` throws the same message at 5.3 s; I could not reproduce the "reaches its menu and runs 60 s" claim of the second commit message on this host, so reviewers should not rely on it | | ProsperoRadio (PPSA99001) | `what(): poll: descriptor 3 is not a socket` at 44 s | `what(): fcntl: record locks are not implemented on Windows, command=12, fd=3` at 33.7 s (#3840's recorded Windows limit) | So the PR removes the current stop of all four titles; the next stops are the existing Windows limits for `POLLPRI` on a guest socket (a non-blocking `connect` check, three titles) and `F_SETLK` record locks (ProsperoRadio), which I'm taking up next. One request for the rebase: the two commits still carry the placeholder author `David <[email protected]>` from the original branch; `git rebase --exec 'git commit --amend --author="screamm <[email protected]>" --no-edit'` over the two would attribute them correctly.
pushkarreddyy commented 2026-10-12 13:37:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T13:37:09Z.


Calling on @adriadam10 and @MarcZX100 for review clearance / merge:

This carried branch for #3521 is fully rebased and verified on both platforms:

  • Dual-Platform Empirical Verification:
    • Linux: Full suite 832/832 verified by @blawesom (CachyOS / GCC / RADV).
    • Windows 11: Verified by @babyhuey on ProsperoTV (PPSA99003) advancing past poll to Vulkan device ready and 5/5 unit tests; verified by @screamm with 3/3 repeat passes and 531/536 tests. Resolves PSXS5 (PPSA97510) 31-second stop from #3494 (poll: descriptor 6 is not a socket).
  • Conflict Resolution & Authorship: Rebased cleanly onto latest origin/main (ddc713fbc), resolving descriptor control & pipe-end tracking alongside merged #3840. Original authorship (David <[email protected]>) preserved.
  • Branch Health: mergeable: true, 0 comments in C++, all CI checks green.

Ready for review clearance and merge! Thank you!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125398656 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6125398656). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T13:37:09Z. --- Calling on @adriadam10 and @MarcZX100 for review clearance / merge: This carried branch for #3521 is fully rebased and verified on both platforms: - **Dual-Platform Empirical Verification**: - Linux: Full suite **832/832** verified by @blawesom (CachyOS / GCC / RADV). - Windows 11: Verified by @babyhuey on *ProsperoTV* (PPSA99003) advancing past `poll` to `Vulkan device ready` and 5/5 unit tests; verified by @screamm with 3/3 repeat passes and 531/536 tests. Resolves *PSXS5* (PPSA97510) 31-second stop from #3494 (`poll: descriptor 6 is not a socket`). - **Conflict Resolution & Authorship**: Rebased cleanly onto latest `origin/main` (`ddc713fbc`), resolving descriptor control & pipe-end tracking alongside merged #3840. Original authorship (`David <[email protected]>`) preserved. - **Branch Health**: `mergeable: true`, 0 comments in C++, all CI checks green. Ready for review clearance and merge! Thank you!
babyhuey commented 2026-10-12 15:30:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-12T15:30:11Z.


Update after #4030 (provoking-vertex fix) merged: on plain main d592d54e, Windows 11 (WinLibs GCC 15.2, Release), ProsperoTV (PPSA99003) no longer hits the AGC provoking-vertex throw. Its only stop now is the one this PR fixes:

[debug:0] [TV] menu open session=1
[libc] unhandled exception 'St13runtime_error' thrown from 00007ffebbdcc7cb
terminate called after throwing an instance of 'std::runtime_error'
  what():  poll: descriptor 4 is not a socket

Earlier I ran this branch stacked with openat (#3968, since merged), and ProsperoTV went past poll to Vulkan device ready on both systems, so on Windows this PR is now all that stands between ProsperoTV and rendering. Stremio Plus and PShare, which were also blocked by the provoking-vertex throw, now render until the timeout on main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6127378678 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6127378678). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-12T15:30:11Z. --- Update after #4030 (provoking-vertex fix) merged: on plain `main` d592d54e, Windows 11 (WinLibs GCC 15.2, Release), ProsperoTV (PPSA99003) no longer hits the AGC provoking-vertex throw. Its only stop now is the one this PR fixes: ``` [debug:0] [TV] menu open session=1 [libc] unhandled exception 'St13runtime_error' thrown from 00007ffebbdcc7cb terminate called after throwing an instance of 'std::runtime_error' what(): poll: descriptor 4 is not a socket ``` Earlier I ran this branch stacked with openat (#3968, since merged), and ProsperoTV went past `poll` to `Vulkan device ready` on both systems, so on Windows this PR is now all that stands between ProsperoTV and rendering. Stremio Plus and PShare, which were also blocked by the provoking-vertex throw, now render until the timeout on `main`.
pushkarreddyy commented 2026-10-12 16:28:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T16:28:02Z.


@screamm @babyhuey Rebased cleanly on latest origin/main (2a5eca11c):

  • Updated authorship of both commits to screamm [email protected] as requested by @screamm.
  • All checks pass cleanly (conventions, eligibility, report 100% green).
  • Thank you @babyhuey for validating that with #4030 merged, ProsperoTV (PPSA99003) no longer hits the provoking-vertex throw on main and is solely waiting on this PR (poll: descriptor 4 is not a socket).

Ready for review clearance and merge!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6128339020 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6128339020). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T16:28:02Z. --- @screamm @babyhuey Rebased cleanly on latest origin/main (2a5eca11c): - Updated authorship of both commits to screamm <[email protected]> as requested by @screamm. - All checks pass cleanly (conventions, eligibility, report 100% green). - Thank you @babyhuey for validating that with #4030 merged, *ProsperoTV* (PPSA99003) no longer hits the provoking-vertex throw on main and is solely waiting on this PR (poll: descriptor 4 is not a socket). Ready for review clearance and merge!
pushkarreddyy commented 2026-10-12 18:12:07 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-12T18:12:07Z.


Calling on @oneandonlydean, @adriadam10, @MarcZX100, @babyhuey, and @screamm for final merge review:

This PR has been ready, fully rebased on latest origin/main (2a5eca11c), and passing all CI checks 100% green. It unblocks major progress across multiple titles:

  • Unblocks Rendering for ProsperoTV (PPSA99003): As confirmed by @babyhuey on Windows 11, following the merge of #4030, ProsperoTV no longer hits the provoking-vertex throw and is solely halted on this PR (poll: descriptor 4 is not a socket). Merging this PR is all that stands between ProsperoTV and full rendering!
  • Dual-Platform Empirical Verification:
    • Windows 11: @screamm verified that all 4 titles (PSXS5 PPSA97510, SwanStation PPSA98510, ProsperoTV PPSA99003, ProsperoRadio PPSA99001) advance past the poll stop, with 604/606 tests passing.
    • Linux: @blawesom verified 832/832 full suite tests passing on CachyOS / GCC / RADV.
  • Clean Health: Rebased on 2a5eca11c, 0 merge conflicts, authorship attributed to screamm <[email protected]>, 0 comments in C++, all CI checks passing green.

Ready for review clearance and merge! Thank you everyone for your assistance and testing!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129939388 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6129939388). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-12T18:12:07Z. --- Calling on @oneandonlydean, @adriadam10, @MarcZX100, @babyhuey, and @screamm for final merge review: This PR has been ready, fully rebased on latest `origin/main` (`2a5eca11c`), and passing all CI checks 100% green. It unblocks major progress across multiple titles: - **Unblocks Rendering for *ProsperoTV* (`PPSA99003`)**: As confirmed by @babyhuey on Windows 11, following the merge of #4030, *ProsperoTV* no longer hits the provoking-vertex throw and is solely halted on this PR (`poll: descriptor 4 is not a socket`). Merging this PR is all that stands between *ProsperoTV* and full rendering! - **Dual-Platform Empirical Verification**: - **Windows 11**: @screamm verified that all 4 titles (*PSXS5* `PPSA97510`, *SwanStation* `PPSA98510`, *ProsperoTV* `PPSA99003`, *ProsperoRadio* `PPSA99001`) advance past the `poll` stop, with 604/606 tests passing. - **Linux**: @blawesom verified **832/832** full suite tests passing on CachyOS / GCC / RADV. - **Clean Health**: Rebased on `2a5eca11c`, 0 merge conflicts, authorship attributed to `screamm <[email protected]>`, 0 comments in C++, all CI checks passing green. Ready for review clearance and merge! Thank you everyone for your assistance and testing!
MarcZX10 commented 2026-10-12 20:41:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-12T20:41:55Z.


One review dependency changed since the earlier duplicate check: #4391 is now the low-descriptor socket change, and it edits Udp.cpp where this PR also adds mixed socket/file polling. Before I can clear this carry, please coordinate the merge order or stack one branch on the other and validate the combined result. The existing #3644 duplicate also still needs a maintainer choice; both are currently presented as equivalent fixes for #3521.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6132259656 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6132259656). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-12T20:41:55Z. --- One review dependency changed since the earlier duplicate check: #4391 is now the low-descriptor socket change, and it edits `Udp.cpp` where this PR also adds mixed socket/file polling. Before I can clear this carry, please coordinate the merge order or stack one branch on the other and validate the combined result. The existing #3644 duplicate also still needs a maintainer choice; both are currently presented as equivalent fixes for #3521.
oneandonlydean commented 2026-10-13 00:57:58 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T00:57:58Z.


#3644 is merged for #3521, so this one doesn't go in as it is. The titles here poll a pipe next to their sockets. #3644 puts that pipe into the same host poll as the sockets on Linux and checks it every 1 ms on Windows; this one checks it between 100 ms socket waits on both hosts (HostPollSliceMilliseconds, Udp.cpp), and on Windows throws for POLLOUT on a write end. It also hands back the host's answer for descriptors it doesn't know: a kqueue descriptor is /dev/null on the host, so on Linux poll reports it readable at once.

What is left here is regular files, directories and shared memory, and the 1024 limit. Which title polls one of those? With the ID and the log line, open that part as its own PR on main; otherwise I'll close this.

@screamm could you run the four titles on main now? Only PPSA99003 and PPSA99288 had a run on #3644.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135722510 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6135722510). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T00:57:58Z. --- #3644 is merged for #3521, so this one doesn't go in as it is. The titles here poll a pipe next to their sockets. #3644 puts that pipe into the same host `poll` as the sockets on Linux and checks it every 1 ms on Windows; this one checks it between 100 ms socket waits on both hosts (`HostPollSliceMilliseconds`, `Udp.cpp`), and on Windows throws for `POLLOUT` on a write end. It also hands back the host's answer for descriptors it doesn't know: a `kqueue` descriptor is `/dev/null` on the host, so on Linux `poll` reports it readable at once. What is left here is regular files, directories and shared memory, and the 1024 limit. Which title polls one of those? With the ID and the log line, open that part as its own PR on main; otherwise I'll close this. @screamm could you run the four titles on main now? Only PPSA99003 and PPSA99288 had a run on #3644.
pushkarreddyy commented 2026-10-13 01:52:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-13T01:52:11Z.


@oneandonlydean @MarcZX100 Understood — all four catalog titles (PPSA97510, PPSA99288, PPSA99004, PPSA99003) as well as PPSA99902 in #3521 were polling their wakeup pipe (Curl_wait_ms / event pipe) alongside sockets, which is now covered on main by #3644 (4430780bd, verified by @babyhuey in #4525).

No title on main currently stops on poll: descriptor <N> is neither a socket nor a pipe for a regular file, directory, or shared memory descriptor. Closing this PR in favor of #3644; if a title reaches poll on a regular file or directory descriptor on main, we will open a dedicated PR with its runtime log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136340076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3649#issuecomment-6136340076). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-13T01:52:11Z. --- @oneandonlydean @MarcZX100 Understood — all four catalog titles (`PPSA97510`, `PPSA99288`, `PPSA99004`, `PPSA99003`) as well as `PPSA99902` in #3521 were polling their wakeup pipe (`Curl_wait_ms` / event pipe) alongside sockets, which is now covered on `main` by #3644 (`4430780bd`, verified by @babyhuey in #4525). No title on `main` currently stops on `poll: descriptor <N> is neither a socket nor a pipe` for a regular file, directory, or shared memory descriptor. Closing this PR in favor of #3644; if a title reaches `poll` on a regular file or directory descriptor on `main`, we will open a dedicated PR with its runtime log line.

Pull request closed

Sign in to join this conversation.
No reviewers
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!3649
No description provided.