fix(libkernel): select descriptors that are not sockets #3462
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3462"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-11T10:59:20Z.
What
Successor to closed #1706, rebased onto current
mainon top of merged #3455 (which owns the/dev/random,/dev/urandomand descriptor 0-2 special cases, kept unchanged here).selectthrewNotImplemented_nid_no_patch("select on descriptors that are not libSceNet sockets")for every descriptor the socket poller did not know. It still throws for those, with one exception: a descriptor the socket poller reports asUnknownthat is belowGuestSockets::FirstDescriptor(0x10000000) is polled on the host viapoll()(Unix; Windows still throws), so regular file and pipe descriptors work. Classification comes from the poller itself, which is the authority for what is a socket: dispatching on the fd number alone was wrong, since socket descriptors can also be small (theguest_sce_netharness covers exactly that, and it caught the first version of this rebase).An invalid host descriptor (
POLLNVAL) fails withEBADF, and mixed host and socket sets are polled in short alternating 10 ms slices so neither side waits out the full slice alone (review point: previously sockets got a 0 ms poll while the host poll waited up to 100 ms).New test
core/libs/tests/GuestSelect.cpp, registered asguest_selectbesideguest_poll, carried over from #1706 and gated to non-Windows (Windows still throws for non-socket descriptors).Relationship to #3455
This builds on merged #3455: its device handling and
UnknownDescriptorthrows are untouched; host fallback is added only for the remaining descriptors the poller does not know. #3476 carried the same commits and also merged; both are in the base.Tested
Wobbly Life (PPSA29413) on Linux (CachyOS), GCC 16.2.1, Intel i5-12400 + NVIDIA RTX 3060 Ti (615.71.09) stops on
mainwith exactly the log line from #1706's close message:With this branch the title proceeds past it into content streaming (menu renders; since #846 and friends, via bring-up #2211). Downstream streaming then hits unrelated, flaky device loss, tracked separately in #3463.
New
guest_selectunit test passes, andguest_sce_net(with #3455's cases) passes, both verified locally in aBUILD_TESTING=ONbuild.guest_selectis registered Unix-only since Windows still throws for non-socket descriptors, see TechnicalDebt.Checklist
main; rebases the #1706 change onto merged #3455 (see above)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebtImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:38:58Z.
Review: CHANGES_REQUESTED
Checked: builds on Linux,
guest_selectpasses, and it fails onmainwithout theSocket.cppchange. Points to fix before this can merge:select_nid_postfixbranch for non-socket descriptors (Socket.cpp,GuestSceNet.cpp). Both cannot land. Please decide with its author how the two combine: #3455 reports fixed values for/dev/random,/dev/urandomand descriptors 0-2 (needed on Windows, titles in #2811), this PR polls the real host descriptor. If you keep yours, rebase on top of #3455 once it merges, replace only the part you want to change (e.g. polling real descriptors instead of fixed values for/dev/*), and list #3455 under Depends on.core/libs/prx/libkernel/CMakeLists.txt:800-809:guest_selectis registered on Windows too, whereselectstill throws for pipes (Socket.cpp:132), so the test would abort there. Register it underif(NOT WIN32), or implement the Windows path.Socket.cpp:41-51:RequestedDescriptorandHostPollDescriptorare the same struct; use one.Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-11T11:46:06Z.
Thanks for verifying. All four points are addressed in the updated commit:
UnknownDescriptor, and to list #3455 under Depends on at that point. Noting #3476 carries the same commits; this rebases onto whichever lands.guest_selectis now registered underif(NOT WIN32)only.RequestedDescriptorandHostPollDescriptorare merged into onePolledDescriptor.Verified locally:
check_conventions.pypasses,guest_selectpasses in aBUILD_TESTING=ONbuild, and the title run still clears the select abort.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T11:50:57Z.
Review: CHANGES_REQUESTED
Rechecked the updated head: builds on Linux,
guest_selectpasses and fails without theSocket.cppchange, and the earlier points are addressed.What is left before it can merge:
select_nid_postfixbranch): both cannot land. Once #3455 merges, please rebase, keep its/dev/random,/dev/urandomand descriptor 0-2 handling (needed on Windows, where this PR still throws) and host-poll only the remaining descriptors belowGuestSockets::FirstDescriptor. List #3455 under Depends on.Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-11T12:11:16Z.
Rebased onto merged #3455 and addressed the remaining points:
UnknownDescriptorthrows are untouched; host fallback applies only to descriptors the socket poller reports asUnknownbelowGuestSockets::FirstDescriptor(Unix; Windows still throws). Listed under Depends on.guest_sce_net: its harness uses small-numbered socket descriptors (fd 38 hit hostpoll()withPOLLNVAL). Now a non-blocking poller probe classifies first; only unknowns fall through to host poll. That probe also confirmed the number-range assumption was wrong, so it is gone.guest_selectunderif(NOT WIN32), one sharedEntrystruct (the two local structs are gone entirely), TechnicalDebt line next to the select entry.Verified: conventions pass,
guest_selectandguest_sce_netpass in aBUILD_TESTING=ONbuild, and Wobbly Life runs 813 file opens with zero select aborts, reaching the in-tutorial MSAA stop (#419).Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T21:24:22Z.
Review: APPROVED
Checked on Linux: builds on current
main,guest_selectpasses and fails without theSocket.cppchange, andguest_sce_netstill passes (small-numbered socket descriptors keep going through the poller). Points from the earlier reviews are addressed (rebase on #3455, classification by the poller,EBADF, alternating slices, Unix-only test, TechnicalDebt line). Merging.Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T21:26:44Z.
Windows build result after this merged: current main
14a7e64dc, Windows 11 x64, MinGW GCC 15.2, Release.cmake --build build-windows --target libs --parallel 4fails while compilingcore/libs/prx/libkernel/Socket/src/Socket.cpp:HostPollis defined inside#ifndef _WIN32, but the new mixed-host/socket and host-only branches ofselect_nid_postfixcall it outside that guard. The preceding Windows build onb3ae11201succeeded. Linux was not tested in this comparison.AI-assisted: yes (Codex).
Imported from boykopovar/AnyPS5. Originally posted by Mouhand-Kaddo on 2026-10-11T21:34:14Z.
The Windows build failure is fixed in #4021. On main
989146c3b,libkernelfails at bothHostPollcalls; with the platform guard, the fulllibsbuild succeeds and all five focused Windows socket/module tests pass. Local testing was Windows-only. AI-assisted with Codex.