feat(libkernel): implement _fstatfs #2858
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2858"
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-10T16:48:23Z.
What
Implements
_fstatfs(17Mfe1B3X6U) in libkernel. The commit is @Recapi's (Recapi:feat/libkernel-fstatfs 756439c, rebased ontomainwith their authorship kept). They can't open a PR yet because of the intake check, and it handles more than my first version of this PR did.It fills the FreeBSD 11
struct statfs(472 bytes,f_version0x20030518) with the host volume that holds the file: block size, transfer size, total, free and available blocks, file counts and maximum name length, plusMNT_RDONLY,MNT_NOSUIDandMNT_NOEXECfromfstatvfson Linux. On Windows it usesGetVolumePathNameW,GetDiskFreeSpaceW/GetDiskFreeSpaceExWandGetVolumeInformationW, mapping onlyFILE_READ_ONLY_VOLUME.EINVAL, as FreeBSD'sgetvnodedoes. On Linux, named FIFOs still work.Stremio Plus (PPSA74126) stops at it on
main57f96fd2(catalog build,eboot.binandsce_module/libc.prxunwrapped as #2605 requires; tracked in #1578):main, Linux:app.elf: symbol lookup error: app.elf: undefined symbol: 17Mfe1B3X6Uapp.elf: symbol lookup error: app.elf: undefined symbol: 04AjkP0jO9U(_umtx_op, #1482)Tested
Linux (Ubuntu 24.04, GCC 13, Release) on
57f96fd2:guest_fstatfspasses 5/5 (--repeat until-fail:5), and the Stremio Plus line above.check_conventions.pypasses. Windows 11 (MinGW-w64 GCC 15.2 from WinLibs, Release) on the same commit:guest_fstatfs5/5, no warnings, and Stremio Plus stops atFAIL: unresolved ELF import 04AjkP0jO9U (_umtx_op) from libkernel.prx.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)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T16:48:46Z.
Progress report (
57f96fd→9a3e55b)➖ System libraries: 84.52% (+0.0%, +1 implemented functions)
✅ 1 implemented
_fstatfs_nid_postfixImported from boykopovar/AnyPS5. Originally posted by Recapi on 2026-10-10T17:00:53Z.
Thanks for opening this and for linking my branch. I can't open a PR myself because of the intake check, so here are the differences between the two, in case you want to fold any of them in. Each piece is in
Recapi:feat/libkernel-fstatfs(756439c), inNativeFstatfsandGuestFstatfs.cpp, and you're welcome to take it as is.fstatfson a pipe fails withEINVAL, becausekern_fstatfsgoes throughgetvnodeand an anonymous pipe has no vnode. Linuxfstatvfssucceeds on a pipe, so with this PR a guest pipe gets a successfulstatfswith 0 blocks: On Windows the same case already returnsEINVAL, but only becauseGetFinalPathNameByHandleWfails on a pipe handle. My branch rejectsS_ISFIFOon pipefs (0x50495045) on Linux, so named FIFOs still work. On Windows it rejectsFILE_TYPE_PIPE. Its test covers both ends of a pipe.EIOhere. In my branch they throw with the path andGetLastError(), following the rule that unmodelled paths throw. The same goes for a zero cluster size, which would otherwise divide by zero, and for a descriptor that is neither a disk file nor a pipe.f_flagsstays 0 here. My branch mapsST_RDONLY,ST_NOSUIDandST_NOEXECtoMNT_RDONLY,MNT_NOSUIDandMNT_NOEXEC. On Windows it maps onlyFILE_READ_ONLY_VOLUME.f_type,f_fstypename, the mount names,f_owner,f_fsidand the I/O counters are left zero or empty, which a title can read. My branch adds an entry under "Functional" for those fields, the Windowsf_files/f_ffreeand the pipe behaviour.None of this changes the Stremio Plus stop. With either version it moves on to
_umtx_op.Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T17:12:04Z.
@Recapi your version handles more, so this PR now carries your commit (756439c rebased onto
main57f96fd2as9a3e55b8, with you as the author). The only rebase conflict wasTechnicalDebt.md, wheremainhad added lines next to yours; I kept both. On Linuxguest_fstatfspasses 5/5 and Stremio Plus goes on to_umtx_op. The Windows run is in progress, and I've updated the description to match.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T17:25:24Z.
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)docs/dev/TechnicalDebt.mdL477docs/dev/TechnicalDebt.mdL477