fix(libkernel): poll libSceNet sockets with the host wait #4933
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4933"
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 nicolasfalesy on 2026-10-13T05:10:45Z.
What
Follow-up to #4924 (and #4391). With libSceNet sockets on ordinary descriptor numbers,
pollon a libSceNet socket throws:pollonly knew libkernel sockets and pipes.selectalready handles libSceNet sockets through the poller libSceNet registers, butpollnever asked it.libSceNet now registers a native lookup with libkernel (
KernelSetSocketNativeLookup_nid_no_patch), next to its poller, closer, option setter and status control. For a libSceNet descriptor it returns the host socket plus ashared_ptrowner that keeps that socket open.polluses it whenFindmisses, and puts the host socket into the sameWSAPoll/pollcall as libkernel sockets, with the same flag mapping and the same WindowsPOLLPRIrule. So mixed sets (libkernel sockets, libSceNet sockets, pipes) need no second wait loop, and a concurrentsceNetSocketClosecannot close the host socket under the wait.This branch contains #4391's and #4924's commits; the change here is the last commit (bc299f299).
Tested
Linux (Arch, GCC 16.2.1, Release), on #4924's head plus this commit:
guest_sce_net: new checks thatpollon a libSceNet UDP socket reports nothing, thenPOLLINafter a datagram arrives, and that a set with one libkernel and one libSceNet socket reportsPOLLOUTon both. Without theUdp.cppchange it aborts withpoll: descriptor 7 is neither a socket nor a pipe.ctest: 1002 of 1002 pass (the 8 display-only VideoOut and AGC tests skip).--to-intel), 3 runs of 60 s: no stop. On #4924 alone it aborted on thepollabove. It now reaches its main screen ("Your PCs", "No PCs yet", Sunshine discovery running).tools/check_conventions.py --base upstream/mainpasses.POLLPRIlines inpoll; whichever lands second needs a small rebase.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T08:20:52Z.
Windows test of this PR.
Environment: Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release,
BUILD_TESTING=ON,-j2,libusb-cmakefrom a local checkout. Built frommainc2565f014with this PR and ten other open PRs (#4972, #4967, #4966, #4945, #4938, #4936, #4933, #4898, #4896, #4888) merged together; the merges had no conflict.Result: guest_dup and guest_fstatfs (2 of 2) pass.
Not checked: whether the test fails without the change in the library code; the PR was not tested alone, only in the combined merge; no title run; Linux not tested.
AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T16:46:04Z.
Title evidence for this PR: ProsperoLight (PPSA99002, catalog release) on Windows 11, MinGW GCC 15.2.0, Release, with the original
eboot.binstaged inapp0(as #5040 documents; without it the title takes another path and never gets here).main(and onmainplus my open libkernel PRs) it stops 3 to 5 s in, every run, right after[SOFT-NET] sceNetResolverStartNtoa -> host DNS lookup failedin its launcher log: A local diagnostic build (not part of any PR) showed what descriptor 11 is:GetFileType=FILE_TYPE_CHAR, an empty final path, polled withPOLLOUTamong 2 descriptors. That is theNULplaceholder of a socket number that libkernel's own socket table doesn't know, so it is a libSceNet socket waiting for a connect.AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by Sevthered on 2026-10-13T21:53:47Z.
Tested on Windows with a second title: OpenNOW PS5 0.1 (PPSA99082, catalog release,
eboot.binandsce_module/libc.prxunwrapped from their SELF containers, relinked with--windows). Windows 11, RTX 3080 Ti (NVIDIA 616.56), WinLibs GCC 15.2.0 r7, Release.On
main665ad7da7it stops a few seconds after start-up:Descriptor 7 is the title's non-blocking TCP socket made through libSceNet (its log:
socket domain=2 type=536870913 protocol=6,socket result=7, then a connect that returnsEINPROGRESS).With #4924 and this PR cherry-picked onto
665ad7da7(both apply cleanly) the throw is gone and the title keeps running. Its requests then fail withcurl=7 os_errno=45, the missingSO_ERRORthat #4988 adds. With #4988 as well it runs the full 60 s, no request fails and its decoder qualification completes (GPU qualification profile=4K120 SDR / HARDWARE / 100 MBPS ... qualified=1).So this also unblocks PPSA99082 on Windows.
One note for whoever merges second: #4924 and #4988 conflict in
core/libs/tests/GuestSceNet.cpp, where each adds a call afterCheckKernelTimeouts();(CheckKernelStatusFlags();andCheckSocketError();). Keeping both lines resolves it.AI-assisted: yes (Claude Code); the runs are from my machine.
Imported from boykopovar/AnyPS5. Originally posted by dantdmdarealguy on 2026-10-14T05:45:36Z.
Windows 11 Pro, Intel Core i9-14900K, 128 GB, NVIDIA GeForce RTX 5080 (driver 32.0.16.1714), WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON. Head47dc519e50(with #4924'sfb085e616) and its merge base0f2683cb7d, each built in the same build directory. ProsperoLight (PPSA99002, catalog release),eboot.binandsce_module/libc.prxunwrapped, relinked from each build withrelinker --windows --registry, originaleboot.binkept inapp0, fresh run directory per build.Tests
guest_sce_netpasses 5 of 5 (--repeat until-fail:5). The head'sGuestSceNet.cppwith the libraries atfb085e616(#4924 alone, without this PR'sExport.cpp,Socket.cpp,SocketPoll.hppandUdp.cpp) aborts: So the new checks fail without the change.guest_sce_net,guest_poll,guest_udp,guest_tcp, allguest_socket_*,guest_kernel_fcntlandpatched_libraries(23 tests): 23 of 23 pass on both.tools/check_conventions.py --base 0f2683cb7dandtools/check_test_registration.pypass.ProsperoLight, 60 s runs
0xC0000409after 8.0 to 9.8 s:failures=0.The head's main screen at 57 s:
The branch no longer merges cleanly into
maina14ae8e23:core/libs/tests/GuestSceNet.cppconflicts. The library files merge without conflicts.Verdict: works on Windows. The ProsperoLight stop is gone, and the new test fails without the library change.
Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-14T12:02:07Z.
Another title that stops here: OpenNOW PS5 Prototype (PPSA99082, catalog release), on Windows 11, MinGW GCC 15, Release.
It doesn't reach this idle. With menu input (Enter/arrow key presses sent to its window), it opens
/data/opennow/account.binandnetwork.log, then stops about 10 s in onmain1209d3707:A local log at that throw showed
events=0x4(POLLOUT) andcount=2, and descriptor 7's host handle hasGetFileType=FILE_TYPE_CHAR. That's theNULplaceholder libSceNet sockets hold on Windows, so it's the case this PR handles.With this PR merged onto the same
main, the same input runs for the whole 90 s with no stop. The merge conflicts inGuestSceNet.cppanddocs/dev/debt/libkernel.md; I took this PR's side for both for the run.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T18:00:30Z.
Rebased onto current
main: dropped thefcntlcommit (already merged as #4924) and resolved thedocs/dev/debt/libkernel.mdpoll line. Build and tests for libSceNet/libkernel are green (173/173), andguest_sce_netfails without the change. Merging once the full build is green.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-14T18:02:21Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libkernel.mdL165