feat(libkernel_sys): implement fstatat #7563
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7563"
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-18T14:10:32Z.
What
Implements
fstatat(t6haf4s-eE0) in libkernel_sys, next toopenat,mkdirat,fchmodatandunlinkat, and following them:AT_FDCWD(-100) and absolute paths go tostat, or tolstatwithAT_SYMLINK_NOFOLLOW(0x200).StatInDirectory_nid_no_patch, the same wayOpenInDirectory_nid_no_patchdoes foropenat. It returnsEBADFfor a descriptor that is not open andENOTDIRfor one that is not a directory. Following links, it usessceKernelStat's native-path code, moved intoStatNativeunchanged, so a trailing/on a non-directory givesENOTDIRas instat. Without following, it usesFile::FillLinkStatlikelstat.AT_SYMLINK_NOFOLLOWreturnEINVAL; a null pathEFAULT; an empty oneENOENT.The technical debt entry follows the other
*atfunctions (no guest path aliases or case-insensitive matching below a descriptor,..not kept inside the guest root).Tested
On
15649b70(rebased ontomaina373e85e5after #6411 merged), Linux (Ubuntu 24.04, GCC 13) and Windows 11 (MinGW-w64 GCC 15.2 from WinLibs), Release:guest_kernel_syspasses 5/5 (--repeat until-fail:5) on both. The new cases cover a file and a directory below a descriptor, a trailing/,AT_SYMLINK_NOFOLLOW,AT_FDCWD, an absolute guest path,ENOENT,EFAULT,EINVAL,EBADFandENOTDIRfor a file descriptor, plus a symbolic link followed and not followed (not on Windows, like the existingfchmodatlink cases).Stremio Plus (PPSA74126, catalog release 0.5.11) stops on
mainwithsymbol lookup error: ... undefined symbol: t6haf4s-eE0 (fstatat); nothing open provides it (checked all 851 open PR diffs). With this PR:fstatat, starts its threads and stops at the headlessDisplayWindowVulkan check, like the other UI titles in a headless run.main5bf2e139eit fails to load (unresolved ELF import t6haf4s-eE0 (fstatat) from libkernel_sys.prx, exit0xC0000139, no window). With this PR it runs the full 60 s at 59.94 fps with no UCRT reports and draws its "Link your account" page (QR code, link code, countdown and the "Request a new link" button). Rechecked on the rebased head: 59.93 FPS, same page; Morrowind (PPSA99630) still reaches its ownArchive 'Morrowind.bsa' not foundexit through #6411'sfchown.The stat consumers (
ctest -R "filesystem|fstat|timestamp|app_archive|kernel_sys|stat", 39 tests on the rebased head) also pass 5/5 on both aftersceKernelStatmoved toStatNative, as they do onmain.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)fchown) merged first; this is rebased onto it, keeping both functions and both test blocks inlibkernel_sys/Export.cppandGuestKernelSys.cpp.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:11:05Z.
Progress report (
c22eb87→15649b7)➖ System libraries: 91.56% (+0.0%, +1 implemented functions)
✅ 1 implemented
fstatat_nid_postfixImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:35:58Z.
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/GuestKernelSys.cppL632-637Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel_sys/Export.cppcore/libs/tests/GuestKernelSys.cppcore/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel/File/src/Open.cppcore/libs/prx/libkernel_sys/Export.cppImported from boykopovar/AnyPS5. Originally posted by LeandroLP23 on 2026-10-18T18:06:20Z.
Windows run. Radeon 860M (RDNA 3.5, driver 32.0.13058.8001), Windows 11 26300, WinLibs GCC 15.2.0 r7, Release,
BUILD_TESTING=ON. Build:mainc3591adf9with #7623, #7612, #7611, #7603, #7579, #7563 and #7541 merged together (each merge clean, built once).The build is clean and
guest_kernel_syspasses 3 runs of 3.AI-assisted
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-20T14:08:38Z.
Rechecked against current main: the
StatNativerefactor keeps theNotFoundError_nid_no_patchand Windows ELOOP changes, the error paths matchopenat/unlinkat/readlinkat, and the tests and technical debt entry are in order; merged.