fix(libSceNet): report the FreeBSD errno of every host socket error #4989
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4989"
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 xXPBSXx on 2026-10-13T07:23:59Z.
What
native_error()in libSceNet translated 21 host socket errors to FreeBSD error numbers and returnedEIO(5) for every other one. A title that calls a sceNet socket function sees the translated number insceNetErrnoLoc()and in the0x80410000 | errnoresult, so the missing ones came out as a generic I/O error: for exampleWSAEPROTONOSUPPORT/WSAEPROTOTYPE(sceNetSocket(…, SOCK_STREAM, IPPROTO_UDP)returnedEIO),WSAEDESTADDRREQ,WSAENOPROTOOPT,WSAEFAULT,WSAENETDOWN,WSAEHOSTDOWNandWSAEMFILE.libkernel already keeps the complete table for these errors in
GuestSockets::GuestErrorFromHost(SocketError.hpp, the FreeBSD 11errno.hnumbers).native_error()now uses it on Windows and Linux; every error it translated before keeps its number (compared entry by entry: all 21 Windows and all 21 Linux entries of the oldnative_error()give the same number inGuestErrorFromHost), the others get their FreeBSD number instead ofEIO.Two more differences from FreeBSD, in the same area:
sceNetSendandsceNetSendtowithout an address on an unconnected datagram socket failed withENOTCONN(57) on Windows (sceNetSendmsgends in a call tosceNetSendto, so it gets the same answer; not tested). FreeBSD'ssosend_dgramanswersEDESTADDRREQ(39) for a socket that does not require a connection, and libkernel'ssend/sendtoalready map this case. Linux reportsEDESTADDRREQitself.sceNetSocketwith an unknown socket type and protocol 0 failed withEPROTONOSUPPORT(43). FreeBSD'ssocreatereturnsEPROTOTYPE(41) when no protocol matches a type and the protocol is 0, andEPROTONOSUPPORTwhen a protocol was given.No title evidence: found by calling the sceNet socket functions with invalid arguments on loopback (25 cases) and comparing the errno with the FreeBSD source. The cases that already matched are not touched.
sceNetGetsockopt/sceNetSetsockoptanswerEOPNOTSUPPfor an option they do not implement (FreeBSD:ENOPROTOOPT) and are left as they are (a deliberate subset, not a mapping problem); this is a new entry indocs/dev/debt/libSceNet.md.Overlap (checked with
git merge-treeagainst the open sceNet PRs): #4988 (SO_ERRORforsceNetGetsockopt) changes neighbouring lines in the libSceNetExport.cpp; textual conflicts also with #4673 (MSG_DONTWAIT: it changes the flags on the line ofsceNetSendwhere this PR changes the error function), which resolves by keeping both changes. #4988 conflicts with this PR indocs/dev/debt/libSceNet.mdas well as inExport.cpp. #5349 (auto-bind an unbound stream socket insceNetListen) also conflicts with this PR in the libSceNetExport.cpp; whichever lands second rebases that hunk. (git merge-treeof the heads of this PR and #4988, #4673 and #5349, re-checked; each conflicts only in the files named; #4610 is merged and no longer in the list.)Tested
Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, on
mainc2565f014; the code is unchanged since, the branch is one commit onmain0f2683cb7and adds a TechnicalDebt entry:guest_sce_net_errors(new; the other host errors listed above are covered by the table change, not by a case each):sceNetSocketwith an unknown type (protocol 0: 41, protocol 6: 43), a stream socket with the UDP protocol (43),sceNetSendandsceNetSendtowithout an address on an unconnected datagram socket (39), andbindof a non-local address (49, already correct before) throughsceNetErrnoLoc.Export.cpp(a socket of an unknown type and protocol 0 must fail with EPROTOTYPE (41) (errno 43); the first failing case, the later ones were checked by hand).guest_sce_netpasses.python tools/check_conventions.py --base upstream/mainpasses.main0f2683cb7:guest_sce_net_errorstakes 0.19 s (ctest, serial, Windows). The fullguest_*/ libc / libkernel group passes (391 of 391, 0 failed; the build also contains the other branches of this series).Checklist
main; no other open PR implements the same functions (overlaps described above)NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (docs/dev/debt/libSceNet.md, new entry for theEOPNOTSUPPanswer ofsceNetGetsockopt/sceNetSetsockopt).mdfiles or images added to the repositoryAI-assisted (Claude Code).
🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-13T07:31: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)core/libs/prx/libSceNet/Export.cppL840-841docs/dev/debt/libSceNet.mdL11core/libs/prx/libSceNet/Export.cppL110-135, L143-171docs/dev/debt/libSceNet.mdL11Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:34:51Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed