AnyPS5/core/libs/prx
screamm e99816e8f3 fix(libkernel): give guest sockets ordinary descriptor numbers below FD_SETSIZE
libkernel numbered guest sockets from GuestSockets::FirstDescriptor
(0x10000000), so a title that puts a socket in a 1024-bit fd_set writes
fd / 8 bytes past it. The Epic Online Services SDK does this on its
RtcNetworkThread and three titles stop there (#1794):

Palworld PPSA23126 (queeeef, main a11c8f7f7):
  FATAL: unhandled exception 0xc0000005 on thread 37164 'RtcNetworkThread'
    rip 0x00007ffcdb1ea2be eossdk-ps5-shipping.prx.guest.prx+0xdea2be
    rcx 0000000010000005 rsi 0000000000400000 r12 0000000010000005
The Mound PPSA26223 (xXPBSXx, main 0a8b1d32b):
  FATAL: unhandled exception 0xc0000005 on thread 'RtcNetworkThread',
  rip eossdk-ps5-shipping.prx.guest.prx+0xefc6f4, rcx = 0x10000005,
  rsi = 0x400000
Dying Light 2 PPSA02262 (tv7):
  FATAL: unhandled exception 0xc0000005 on thread 'RtcNetworkThread'
    rcx 0000000010000005 ... rsi 0000000000400000 ... r12 0000000010000005

On FreeBSD 11.4 (8c639945) FD_SETSIZE is 1024 (sys/sys/select.h:58-59)
and sockets take the lowest free entry of the one process descriptor
table that files use (kern_descrip.c:1643-1660 fdalloc,
uipc_syscalls.c kern_socket through falloc).

Every socket number is now a real host descriptor: a zero-access NUL
handle registered with _open_osfhandle on Windows (as directory
descriptors already are) and an F_DUPFD_CLOEXEC duplicate of the host
socket on Linux. The socket table maps that number to the socket, so
"is this a socket" is a table lookup instead of a range check at the 31
former FirstDescriptor comparisons. close releases both the socket entry
and the number, dup and dup2 duplicate the number through the host table
and keep the socket shared, dup2 of a file onto a socket number drops the
socket entry, and sceKernelClose now closes sockets too. sceNetSocket and
sceNetAccept take their ids from the same table instead of a counter from
32, so libkernel and libSceNet numbers never collide.

select polls guest sockets alongside libSceNet sockets, the random device,
stdio and (on Linux) host descriptors; poll throws only for an open
descriptor that is not a guest socket and reports POLLNVAL otherwise.
File calls that used to fail with EBADF on the socket range return
FreeBSD's answer for a socket: lseek ESPIPE (kern_lseek), ftruncate and
getdirentries EINVAL (invfo_truncate, getvnode), flock EOPNOTSUPP;
fstat on a socket throws. pread on a closed descriptor returns EBADF.

title failing on host descriptor numbers; these three titles are that
case, and this change keeps host numbering for files and only moves
sockets into it.

Tests: guest_socket_descriptors (new: socket below 1024, select on a
socket and a file together, close frees the number for a file, dup of a
socket, sceKernelClose), guest_select (socket and pipe together, Linux),
guest_poll, guest_dup, guest_socket_pair, guest_fstatfs,
guest_posix_filesystem and guest_sce_net updated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
(cherry picked from commit 20378375b31eb5db922db6e55f45e44a4dae6445)
2026-10-13 03:22:36 +00:00
..
libReactNative.Modules.Vsh
…
libReactNative.Modules.Vsh.WebAppLauncher
…
libSceAcm fix(exports): export the calls PPSA02530 imports 2026-10-12 21:51:36 +02:00
libSceAgc feat(agc): return null from the workload builders for unregistered streams 2026-10-12 15:22:21 -04:00
libSceAgcDriver Merge pull request #4586 from ee6aba54/fix/agc-lookahead-write-data 2026-10-13 15:37:38 +13:00
libSceAgcVsh
…
libSceAjm
…
libSceAjm.native feat(ajm): decode Opus surround mapping family 2026-10-12 02:28:14 +04:00
libSceAjmi
…
libSceAmpr Merge pull request #4207 from xXPBSXx/fix/ampr-amm-usage-stats 2026-10-12 22:57:04 +02:00
libSceAppContent feat(libSceAppContent): implement sceAppContentGetAddcontDownloadProgress 2026-10-11 07:48:11 +02:00
libSceAudio
…
libSceAudio3d fix(audio): pace blocking audio calls with a high-resolution timer 2026-10-10 01:31:57 +02:00
libSceAudioIn Merge pull request #3669 from MarcZX100/carry/audioin-open-variants-3340 2026-10-11 23:46:54 +02:00
libSceAudioOut test(cmake): serialize load-sensitive Windows tests 2026-10-12 18:46:19 +00:00
libSceAudioPropagation fix(audio): bind singular propagation path setter as unsupported 2026-10-10 03:50:02 +02:00
libSceAudiodec fix(audiodec): take the M4AAC raw channel layout from the stream 2026-10-08 17:29:46 +02:00
libSceAudiodec.native fix(audiodec): build libSceAudiodec.native from the libSceAudiodec sources 2026-10-06 17:48:38 +02:00
libSceAvPlayer test(avplayer): link guest_avplayer with the shared runtime libraries 2026-10-12 02:47:43 +00:00
libSceAvPlayer.native refactor(libSceAvPlayer): build libSceAvPlayer.native from the shared Export.cpp 2026-10-07 06:19:46 +00:00
libSceBluetoothHid feat(libSceBluetoothHid): add Bluetooth HID with no devices attached 2026-10-08 15:30:58 +13:00
libSceCdlgG2P feat(libs): run the G2P and VR setup dialogs as common dialogs without UI 2026-10-10 22:53:48 +00:00
libSceCdlgPlayerReview feat(libSceCdlgPlayerReview): add the player review dialog 2026-10-07 22:07:28 +03:00
libSceCesCs feat(libSceCesCs): add sceCesRefersUcsProfileCp1251 and sceCesMbcsUcsContextInit 2026-10-11 16:20:47 +02:00
libSceCommonDialog
…
libSceContentDelete fix(content): export the content calls PPSA06465 imports 2026-10-11 09:23:39 +02:00
libSceContentExport feat(libSceContentSearch): implement the search calls over an empty library 2026-10-13 00:34:12 +05:30
libSceContentSearch feat(libSceContentSearch): implement the search calls over an empty library 2026-10-13 00:34:12 +05:30
libSceConvertKeycode fix(exports): export the calls PPSA07411 imports 2026-10-11 18:35:00 +02:00
libSceErrorDialog build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceFiber feat(libSceFiber): add the underscore thread frame pointer export 2026-10-11 09:30:02 -07:00
libSceFont Merge pull request #4014 from ahir061/fix/macos-executable-directory 2026-10-13 01:56:47 +13:00
libSceFont-module
…
libSceFont.native
…
libSceFontFt feat(font): implement sceFontGetFontGlyphsCount and sceFontGetCharGlyphCode 2026-10-06 09:23:44 +02:00
libSceFontFt-module
…
libSceGameLiveStreaming feat(libs): implement sceGameLiveStreamingGetCurrentStatus2 2026-10-09 23:56:40 +02:00
libSceGameUpdate build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceHmd test(hmd): register disconnected-device tests 2026-10-09 17:47:28 +00:00
libSceHmd2 fix(exports): export the calls PPSA29866 imports 2026-10-12 21:32:38 +02:00
libSceHttp Merge pull request #3706 from MarcZX100/codex/http-abort-wait-3156 2026-10-11 23:53:59 +02:00
libSceHttp2 feat(libSceHttp2): implement sceHttp2DeleteCookieBox 2026-10-12 12:24:57 +02:00
libSceIme feat(libSceIme): implement sceImeGetPanelPositionAndForm 2026-10-09 23:36:28 +02:00
libSceImeBackend
…
libSceImeDialog
…
libSceJobManager fix(libSceJobManager): count a wait before serialising it and close under the lock 2026-10-11 07:40:37 +02:00
libSceJpegDec build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceJpegEnc build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceJson2 Merge pull request #3814 from xXPBSXx/fix/export-ppsa30601-imports 2026-10-12 21:36:02 +13:00
libSceKeyboard build: route system dependency include paths and pin the shader cache to package versions 2026-10-11 10:18:23 +02:00
libSceLibcInternal Merge pull request #4653 from Lorkydey/feat/libc-statvfs 2026-10-12 23:08:17 +02:00
libSceLoginDialog build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceMbus feat(libSceMbus): add the device service with no devices attached 2026-10-08 15:30:58 +13:00
libSceMouse fix(exports): export the calls PPSA30601 imports 2026-10-11 19:02:18 +02:00
libSceMsgDialog
…
libSceMsgDialog.native build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceNet fix(libkernel): give guest sockets ordinary descriptor numbers below FD_SETSIZE 2026-10-13 03:22:36 +00:00
libSceNetCtl
…
libSceNetCtlApDialog feat(libSceNetCtlApDialog): run the offline access-point dialog lifecycle 2026-10-12 20:03:59 +01:00
libSceNgs2 build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libSceNgs2.native fix(libSceNgs2): reject unverified listener transforms 2026-10-12 23:12:40 +02:00
libSceNpAuth feat(libSceNpAuth): return the signed-out error from sceNpAuthGetAuthorizedAppCode 2026-10-12 22:54:23 +02:00
libSceNpAuthAuthorizedAppDialog feat(libSceNpAuthAuthorizedAppDialog): add the dialog, with NpAuth and SaveData imports of Minecraft 2026-10-12 08:53:30 +00:00
libSceNpCommerce feat(libs): name the PPSA23566 stubs from the shadPS4 NID list and implement sleep 2026-10-06 17:28:39 -05:00
libSceNpEntitlementAccess feat(libSceNpEntitlementAccess): implement sceNpEntitlementAccessGetGameTrialsFlag 2026-10-12 21:58:36 +02:00
libSceNpGameIntent
…
libSceNpManager docs(npmanager): name ZVZ++68nNI8 sceNpGetSandboxInfo (throwing stub), imported by PPSA28416 2026-10-11 00:15:48 +02:00
libSceNpPartner001 feat(libSceNpPartner001): implement sceNpEAAccessInitialize and sceNpEAAccessTerminate 2026-10-12 18:46:44 +00:00
libSceNpSessionSignaling feat(libSceNpSessionSignaling): answer connection status queries offline 2026-10-12 22:05:23 +01:00
libSceNpTrophy2 fix(libSceNpTrophy2): accept a null details or data in GetTrophyInfo and GetGroupInfo 2026-10-11 15:35:56 +02:00
libSceNpUniversalDataSystem
…
libSceNpUtility
…
libSceNpWebApi2 feat(libSceNpWebApi2): export sceNpWebApi2AddWebTraceTag 2026-10-12 01:30:54 +02:00
libSceOpusCeltDec fix(opus): export the libSceOpusCeltDec module 2026-10-11 07:10:03 +09:00
libSceOpusDec feat(opus): implement 48 kHz libSceOpusDec 2026-10-09 19:24:56 +04:00
libScePad fix(exports): export the calls PPSA02530 imports 2026-10-12 21:51:36 +02:00
libScePlayGo docs(libScePlayGo): record where the chunk set comes from 2026-10-11 12:30:52 +02:00
libScePlayGoDialog build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libScePlayerInvitationDialog build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libScePlayerSelectionDialog
…
libScePngDec build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libScePngEnc build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00
libScePosixForWebKit fix(libkernel): give guest sockets ordinary descriptor numbers below FD_SETSIZE 2026-10-13 03:22:36 +00:00
libSceProprietaryVoiceChatHelperPrx feat(libs): name the PPSA23566 stubs from the shadPS4 NID list and implement sleep 2026-10-06 17:28:39 -05:00
libScePsml feat(libScePsml): build libScePsml from the libScePsml_debug source 2026-10-09 20:25:55 +02:00
libScePsml_debug feat(psml): declare scePsmlMfsrCreateContext1300 and scePsmlMfsrGetDispatchMfsrPacket1300 2026-10-10 12:42:01 -05:00
libSceRandom fix(libs): take guest entropy from the host OS instead of std::random_device 2026-10-11 22:07:49 -03:00
libSceRazorCpu feat(libSceRazorCpu): implement sceRazorCpuSync 2026-10-12 21:58:39 +02:00
libSceRemoteplay
…
libSceRtc fix(rtc): reject date strings ending at the minutes 2026-10-12 19:44:03 +00:00
libSceRudp feat(libSceRudp): implement sceRudpGetMaxSegmentSize 2026-10-11 22:43:17 -04:00
libSceSaveData fix(libkernel): flush only the paths the guest changed in sceKernelSync on Windows 2026-10-08 08:27:22 +00:00
libSceSaveData.native feat(libSceSaveData): answer sceSaveDataDirNameSearch2 2026-10-12 22:59:26 +02:00
libSceSaveDataDialog
…
libSceSaveDataDialog.native fix(savedata): keep progress dialogs running until closed 2026-10-08 01:37:34 +03:00
libSceShare feat(libSceShare): implement sceShareCaptureVideoClipExtended 2026-10-12 18:46:45 +00:00
libSceShare.native
…
libSceSharePlay feat(libSceSharePlay): implement sceSharePlayProhibitController 2026-10-12 21:58:43 +02:00
libSceSigninDialog feat(libSceSigninDialog): complete offline sign-in dialog lifecycle 2026-10-11 19:11:37 +04:00
libSceSsl test(exports): drop the PPSA07411 export test 2026-10-11 18:51:54 +02:00
libSceSysmodule feat(libSceSysmodule): register libSceAcm (0x10B) and libScePsml (0x137) module IDs 2026-10-12 16:22:34 +02:00
libSceSystemGesture fix(libSceSystemGesture): report no touch events for the primitive and recognizer calls 2026-10-11 02:01:32 +02:00
libSceSystemService fix(libSceSystemService): answer parameter 400 with the console language 2026-10-12 03:18:00 +02:00
libSceTextToSpeech2 feat(libSceTextToSpeech2): return EOPNOTSUPP from remaining speech exports 2026-10-11 13:43:46 +02:00
libSceUlt feat(libSceUlt): accept option parameters in sceUltQueueCreate and sceUltQueueDataResourcePoolCreate 2026-10-12 22:48:53 +02:00
libSceUsbd fix(libSceUsbd): cancel transfers under the state lock 2026-10-12 22:32:42 +02:00
libSceUserService Merge pull request #4119 from hugodearaujo/fix/accessibility-defaults 2026-10-12 21:41:16 +13:00
libSceVdecsw feat(libs): implement libSceVdecsw on top of libSceVideodec2 2026-10-09 13:28:48 +02:00
libSceVideoOut Merge pull request #3799 from xXPBSXx/fix/export-ppsa02530-imports-v4 2026-10-13 10:00:34 +13:00
libSceVideoRecordingP fix(libSceVideoRecordingP): correct the sceVideoRecordingOpen signature 2026-10-06 18:29:36 -03:00
libSceVideodec2 fix(videodec2): answer picture info from the decoder that last wrote the buffer 2026-10-12 04:06:54 -06:00
libSceVoice feat(libSceVoice): track the port mute flag 2026-10-10 19:59:15 +02:00
libSceVoiceChat feat(libs): provide the exports PPSA01289 imports that no library has 2026-10-09 02:42:57 -04:00
libSceVoiceQoS feat(libSceVoiceQoS): export sceVoiceQoSSetConnectionAttribute 2026-10-12 01:21:46 -04:00
libSceVrSetupDialog feat(libs): run the G2P and VR setup dialogs as common dialogs without UI 2026-10-10 22:53:48 +00:00
libSceVrTracker2 fix(exports): export the PS VR2 calls PPSA07411 imports that no library has 2026-10-12 00:01:07 +02:00
libSceWebBrowserDialog fix(libSceWebBrowserDialog): permit termination from finished state in sceWebBrowserDialogTerminate 2026-10-12 21:58:02 +05:30
libSceXml fix(libSceXml): add an export-free libSceXml for titles that list it 2026-10-11 19:58:13 +02:00
libSceZlib fix(zlib): inherit DWARF unwinding in Windows tests 2026-10-10 02:03:59 +04:00
libc Merge pull request #4738 from milescoviello/carry/fdopen-append-windows-4735 2026-10-13 15:37:03 +13:00
libkernel fix(libkernel): give guest sockets ordinary descriptor numbers below FD_SETSIZE 2026-10-13 03:22:36 +00:00
libkernel_sys feat(libkernel_sys): implement pathconf 2026-10-12 22:56:28 +02:00
libkernel_web
…
ulobjmgr build(libs): strip the MinGW static runtime flags once for all libraries 2026-10-07 10:10:38 +00:00