feat(libkernel_sys): implement getfsstat #12695
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/12695"
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 xdCloudy on 2026-10-29T02:40:09Z.
What
Implements
getfsstat(EARPL-r8jf0) for the AnyPS5 guest mount model. Firmware 13.60 Ghidra analysis oflibkernel_sys.sprx(SHA-25660921322b155ba649cfa29ea5e6d358ca0229424b4f73fd5c30ae7f7ce7c304c) identifies the wrapper at0x1a70invoking syscall 395. The implementation follows the FreeBSD 11.4 buffer-size, mode, count-query and bounded-copy contract; it reports the guest root and registered guest path aliases and fills eachf_mntonnamewith the guest path. Filesystem statistics use the shared host-backed path-statistics provider introduced by #9161, so this PR depends on #9161. The enumerated mounts and host-specific fields do not reproduce the PS5 mount table; limitations are recorded indocs/dev/debt/libkernel_sys.md.Tested
guest_kernel_sys_tests; focusedguest_kernel_sysCTest passed (1/1).guest_kernel_sys_tests; focused test executable passed when launched from/tmp.git diff --checkpassed.Checklist
main; no other open PR implements the same functionNotImplemented_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)Imported from boykopovar/AnyPS5. Originally posted by rooklz on 2026-10-29T03:01:42Z.
Review: COMMENTED
Reviewed at 806b7bd3e3, host-side only. I did no console runs and have no firmware access.
Duplicate export. The checklist says no other open PR implements the same function, but #9161 (yabanana, last updated today, head
d2f98f3910, MERGEABLE) implementsstatfswith the same(const char*, KernelStatfs*)signature. A localpython3 tools/pr_overlap.py --branchon this head reports it:main)core/libs/prx/libkernel_sys/Export.Discovery.cppL2146-2150statfsgit merge-treeagainst3a2b919816is clean for this PR on its own, but it conflicts with #9161 in that hunk. Whichever merges second has to be rebased or dropped. This is the same situation as #12687, wherefutimesat/symlinkatwere also in #9161.#9161's statfs test covers more than this PR's 10 rows:
sizeof(KernelStatfs)wide1) gives EFAULTEvery row here already has an equivalent in #9161; the only difference is that this PR uses
0x10as the bad output pointer where #9161 uses1. Archive-only paths throw in both PRs: here throughResolvePath's "reading" refusal, in #9161 through an explicit"statfs"refusal. So I'd suggest folding anything unique into #9161 instead of landing a secondstatfs.The POSIX branch was never run. Per the body, the Linux run stopped before the new rows, and the PR's
linuxCI lane was skipped. I tookNativeStatfsPathverbatim, along with main'sNativeFstatfs,DeviceFilesystem,SceErrorFromErrno, theGUEST_*constants andNotFoundError_nid_no_patch. I built it with-fsanitize=address,undefinedon Ubuntu 24.04 x86_64 (glibc 2.39, ext4/overlay tmp, non-root). Result: 0 mismatches and no sanitizer reports._fstatfson the same file byte for byte up tof_ownerfile/child/dev/nullDeviceFilesystem512/2/255So the Linux path is correct as written. These results should also hold for #9161's equivalent
NativeStatfsif it keeps the samestat→statvfsorder. Unlike_fstatfs, a FIFO or socket path returns 0 instead of EINVAL. That is consistent with FreeBSD resolving the vnode's mount, but it is worth one debt sentence in whichever PR lands.Conventions pass at this head.
Pull request closed