fix(libSceNet): accept MSG_DONTWAIT in the send and receive calls #4673
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4673"
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 milescoviello on 2026-10-12T18:31:39Z.
What
sceNetSend,sceNetSendto,sceNetRecv,sceNetRecvfrom,sceNetRecvmsgandsceNetSendmsgfailed withEOPNOTSUPPfor every flag other thanMSG_PEEKon a receive, so a game that polls a socket withMSG_DONTWAIT(0x80) got an error on every call instead of its data orEWOULDBLOCK.FreeBSD 11.4 defines the flag in
sys/sys/socket.h:and
soreceive_generic()(sys/kern/uipc_socket.c) treats it as a non-blocking socket for that one call:shadPS4's sceNet uses the same value (
ORBIS_NET_MSG_DONTWAIT = 0x00000080).On Linux and macOS the flag now maps to the host's
MSG_DONTWAIT, alone or withMSG_PEEKon a receive, so the call returns at once with the data orEAGAINand the socket itself stays blocking. Winsock has no per-call non-blocking flag, so on Windows these calls still fail withEOPNOTSUPPfor it; a TechnicalDebt entry records that. Other flags still fail withEOPNOTSUPP.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
mainb9f194a8.guest_sce_netgainedCheckDontWaiton a blocking UDP socket with a 2 s receive timeout: with nothing queued,sceNetRecv,sceNetRecvfrom,sceNetRecvmsgandMSG_DONTWAIT | MSG_PEEKfail withEAGAIN, all within one second; a datagram sent withsceNetSendto(..., MSG_DONTWAIT)is peeked withMSG_DONTWAIT | MSG_PEEKand then read withMSG_DONTWAIT;sceNetSend(..., MSG_DONTWAIT)on a connected socket delivers;MSG_OOBand a send withMSG_PEEKstill fail withEOPNOTSUPP. On Windows the test expectsEOPNOTSUPPfor the flag.main'sExport.cppthe test aborts (EOPNOTSUPPinstead ofEAGAIN).guest_sce_netpasses, also in 30 repeated runs; allguest_*tests exceptguest_video_out_*pass (307/307).Windows: @johnmaia ran it on Windows 11 with WinLibs GCC 15.2.0, merged into
main3faa9cb40.guest_sce_netpasses, withCheckDontWait's Windows branch gettingEOPNOTSUPPfor the flag, and the full suite passes 1074 of 1074. Merges cleanly with #4669 and #4394, which touch the same files.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by johnmaia on 2026-10-13T13:36:56Z.
Windows run, since the description says Windows is untested. Setup: Windows 11 (26300), WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON,ctest -j4 --timeout 300, RTX 4080. Head44d46ee97merged intomain3faa9cb40.guest_sce_netpasses. The_WIN32branch ofCheckDontWaitruns here, sosceNetRecv,sceNetRecvfrom,sceNetRecvmsgandsceNetSendtowithMSG_DONTWAITfail with 45 on Windows, as the test expects.Not tested: a title, and a negative control on Windows.
AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T14:56:20Z.
Checked on Linux merged onto current
main:guest_sce_netand the 30 tests of core/libs pass, and the newCheckDontWaitfails withmain'sExport.cpp(EOPNOTSUPP instead of EAGAIN).sceNetSendmsggoes throughsceNetSendto, so it gets the flag too. The Windows branch is covered by @johnmaia's run; the TechnicalDebt entry is in place. Merging once the full Build is green.