fix(libSceNet): report SO_ERROR from sceNetGetsockopt #4988
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4988"
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 babyhuey on 2026-10-13T07:23:33Z.
What
sceNetGetsockopt(s, SOL_SOCKET, SO_ERROR)(0x1007) used to fail withEOPNOTSUPP. It now returns the socket's pending error as a libSceNet errno, and 0 when there is none, as FreeBSD 11'ssogetoptdoes. The read clears it.SO_ERROR, mapped with the same tablenative_error()already uses forerrno/WSAGetLastError()(nownet_error(code)), so a refused connect reports 61 (ECONNREFUSED).sceNetConnect, as #4796 does for libkernel sockets. That difference is recorded indocs/dev/debt/libSceNet.md.curl checks a non-blocking connect this way: it waits for OUT, then reads
SO_ERROR. So a curl request over libSceNet sockets fails withcurl 7even after the TCP handshake succeeds.Tested
On the PR head
0daf1d5b, Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release:guest_sce_netpasses 5/5 (--repeat until-fail:5) on both. The new check reads 0 from a connected socket. It reads 61 from a refused non-blocking loopback connect, then 0 on the next read. It fails onmain.Export.cpporGuestSceNet.cpp.ProsperoLichess (PPSA99009, catalog release) on Windows 11 (RTX 3080), default flags:
mainevery request fails after about 5.2 s (curl 7: Failed to connect to lichess.org port 443 after 5203 ms). DNS and the TCP handshake work, butsceNetEpollWaitpolls OUT as 4 instead of SCE's 2, which is #4611.curl 7 ... after 112 ms): the OUT wait returns andsceNetGetsockopt(SO_ERROR)fails withEOPNOTSUPP.test/verify-soerr-stack2), it connects. The next stop is TLS: the title loads the console's CA list from/<sandbox>/common/cert/CA_LIST.cer, which AnyPS5 doesn't provide (curl 77).On Linux the headless catalog run stops at the
DisplayWindowthrow before any request.check_conventions.pypasses.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)SO_ERRORonly once OUT is delivered)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T07:31:19Z.
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)core/libs/tests/GuestSceNet.cppL636core/libs/tests/GuestSceNet.cppL671core/libs/tests/GuestSceNet.cppL671core/libs/prx/libSceNet/Export.cppL246, L1004Imported from boykopovar/AnyPS5. Originally posted by Sevthered on 2026-10-13T21:54:46Z.
A second title for this fix, on Windows: OpenNOW PS5 0.1 (PPSA99082, catalog release, unwrapped and relinked with
--windows). Windows 11, RTX 3080 Ti (NVIDIA 616.56), WinLibs GCC 15.2.0 r7, Release.It needs #4924 and #4933 first, to get past
pollon a libSceNet socket. With those two onmain665ad7da7every request ends the same way:With this PR cherry-picked on top, no request fails in a 60 s run and the title goes on to its decoder qualification.
The ProsperoLichess result with this PR on Windows is in #4982: it connects, and with a PEM certificate list in place it goes online.
One note for whoever merges second: this PR and #4924 conflict in
core/libs/tests/GuestSceNet.cpp, where each adds a call afterCheckKernelTimeouts();(CheckSocketError();andCheckKernelStatusFlags();). Keeping both lines resolves it.AI-assisted: yes (Claude Code); the runs are from my machine.