Repository navigation
feat(libSceLibcInternal): implement fdopendir - #4569
Conversation
|
I ran PS5SX2 (PPSA99203) with this PR. Its earlier stops come from open PRs, so I stacked them on
The cause is the module. The title imports So the export probably belongs in libc, next to |
|
Another title for this one: OliSe Player (PPSA01153). Tested on Linux (Ubuntu 24.04, lavapipe) with main b538b28 + #4452 + this PR + #4470, relinked with
AI-assisted: yes |
|
Windows result for the OliSe Player (PPSA01153) run above: on OliSe imports |
e3e796c to
f3b8ef7
Compare
Thanks for testing it on both, that was the bug. The title and the SDK both import
It lives in libSceLibcInternal now ( I rebuilt your
Your OliSe run used |
|
Retested the new head f3b8ef7 on Windows 11 (WinLibs GCC 15.2), with OliSe Player (PPSA01153) on PS5SX2 (PPSA99203), stacked with its other open PRs (#4382, #4530, #3787, #4653), also resolves |
|
Checked on the PR merged onto current main: build and the 96 libs/libc/LibcInternal tests pass, |
What
fdopendir(j+XjoRSIvwU) is not exported, and three catalog homebrew titles stop on it:--trap-sdk-syscall-stubs(feat(relinker): trap exact SDK syscall stubs on request #3804), it stops atfdopendir(@babyhuey's run below).fdopendir(@overlordxrz-source's run below).fdopendirnext oncefchmodatis in (feat(libkernel_sys): implement fchmodat #4553).These titles import
fdopendirfromlibSceLibcInternal.prx, as does the ps5-payload-dev SDK (itssce_stubslist it only inlibSceLibcInternal.c). On Windows the import builder only looks inlibSceLibcInternal.prxand thenlibc.prxfor such an import, so the export lives in libSceLibcInternal. It can't sit next toopendirin libc: it needs libkernel's descriptor lookup, and libc doesn't link libkernel, while libSceLibcInternal links both.The semantics follow FreeBSD 11's
fdopendirandclosedir:fdopendir(libSceLibcInternal). It looks up the descriptor's directory with libkernel'sGetDirectoryDescriptorPath_nid_no_patch. A descriptor that isn't open fails withEBADF, as FreeBSD'sF_SETFDcall does, and one that isn't a directory fails withENOTDIR; both leave the descriptor open.OpenDescriptorDirectory_nid_no_patch(libc). It opens the stream on that directory the wayopendirdoes and keeps the descriptor.closedirthen closes it through libkernel'sclose, as FreeBSD'sclosedirdoes with_close(fdclosedir(dirp)).docs/dev/debt/libSceLibcInternal.md. Two differences from FreeBSD are recorded:FD_CLOEXECisn't set on the descriptor.Tested
Windows 11, WinLibs GCC 15.2.0 r7, Release, on
main682ef0c.guest_fdopendirtest. It links libSceLibcInternal, libkernel and libc.open(O_DIRECTORY), andfdopendirandreaddirlist a file (type 8) and a subdirectory (type 4).closedirreturns 0 and closes the descriptor.-1then fail withEBADF.ENOTDIRand stays open.test/verify-sx5stack with this commit in place of the earlier libkernel export.j+XjoRSIvwUis now exported bylibSceLibcInternal.prxonly. PS5SX2, relinked with--trap-sdk-syscall-stubs, gets past the loader on Windows and runs guest code ([notification] PS5SX2: starting, its HEN config checks,[elevate] already root), as it does on Linux. Before, it failed withFAIL: unresolved ELF import j+XjoRSIvwU (fdopendir) from libSceLibcInternal.prx.ctest: 993 of 993 pass.guest_np_auth_authorized_app_dialogand two AGC execution tests aren't built here, because their object paths exceed WindowsMAX_PATHin my checkout. The same happens onmain.tools/check_conventions.py,tools/check_test_registration.pyandtools/pr_overlap.py --branchpass. The new source line inlibSceLibcInternal/CMakeLists.txtand the libc helper are placed away from the lines that feat(libc): implement readdir_r #3635, feat(libSceLibcInternal): implement posix_spawn actions #3651, feat(libSceLibcInternal): implement getopt and getopt_long #3694 and feat(libc): query filesystem statistics by guest path #4653 change.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)