feat(libkernel_sys): implement fpathconf and _fpathconf #6525
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6525"
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 QuentinRemond on 2026-10-15T18:45:03Z.
What
Implement
fpathconfand_fpathconfinlibkernel_sys. They validate the descriptor usingDescriptorIsOpen_nid_no_patch(EBADFif invalid or closed) and report the FreeBSD 11 UFS constants matchingpathconf(_PC_LINK_MAX32767,_PC_NAME_MAX255,_PC_PATH_MAXand_PC_SYMLINK_MAX1024,_PC_PIPE_BUF512,_PC_CHOWN_RESTRICTEDand_PC_NO_TRUNC1,_PC_FILESIZEBITS64,_PC_REC_MAX_XFER_SIZE-1,_PC_PRIO_IOand_PC_SYNC_IO0). Mount- or kernel-dependent names throw, and unknown names fail withEINVAL.Tested
Linux x86_64 (Fedora): configured with
-DBUILD_TESTING=ON; builtlibs(all 126 PRXs patched OK) andguest_kernel_sys_tests. ctestguest_kernel_syspassed (asserting values on open file descriptor, open directory descriptor, invalid descriptor, and closed descriptor).python3 tools/check_conventions.py --base origin/mainpassed.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)Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-19T01:27:47Z.
Review: COMMENTED
Linux run of
8c2943089on currentmain. Two problems: the merge no longer compiles, and once that is fixedlibkernel_sys.prxno longer loads.Machine: Linux x86_64, i7-8700, Ubuntu 26.04, GCC 15.2, Release,
BUILD_TESTING=ON, full build. Head8c2943089merged ontomainad502d717. Git merges it without conflicts.libkernel_sys/Export.cpp:60: error: redefinition of 'constexpr const int {anonymous}::GuestEbadf'. #6411 (fchown, merged asce8c71a78) added the sameconstexpr int GuestEbadf = 9;two lines above, so the branch needs a rebase that drops its copy. #6411 also added a localGuestFstat(fd)helper in the same file, which could be useful for the next point.patched_librariesfails (mainpasses):DescriptorIsOpen_nid_no_patchis declared inFile.hppas a plain C++ function (noextern "C") and lives inlibkernel(Stdio.cpp).nm -D --defined-onlyfinds it inlibs/unpatched/libkernel.prxbut not in the patchedlibs/libkernel.prx. The other cross-library helpers thatlibkernel_sysalready uses, likeGetDirectoryDescriptorPath_nid_no_patch, areextern "C"and are still exported after patching. This PR doesn't touchlibkernel, so the same unresolved symbol should be there on its own base too.guest_kernel_sysstill passes because it loads the unpatchedlibs/unpatched/libkernel_sys.prxandlibkernel.prx(perldd), so the new test doesn't catch this. One way out is to check the descriptor with somethinglibkernel_syscan already reach, such as #6411'sGuestFstat.guest_kernel_syspasses, and the rest of the non-GPU suite (ctest -E "^agc|gpu|vulkan|video_out" -j6) matchesmain: 746/747, and the only failure ispatched_libraries. The test file alone onmaindoes not link (undefined reference to fpathconf_nid_postfix), as expected.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T03:39:36Z.
Progress report (
e8ad642→8c29430)📈 System libraries: 90.77% (+0.01%, +2 implemented functions)
✅ 2 implemented
_fpathconf_nid_postfixfpathconf_nid_postfixImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T03:39:49Z.
Review: CHANGES_REQUESTED
Thanks, the refactor into
PathConfigurationValueis clean. Two blocking problems on the merged tree (confirmed against currentmain, and matching @jotitadev's run):core/libs/prx/libkernel_sys/Export.cpp:60:constexpr int GuestEbadf = 9;is already defined at line 58 since #6411 (fchown), so the merge fails withredefinition of 'GuestEbadf'. Rebase onmainand drop your copy.core/libs/prx/libkernel_sys/Export.cpp:343:DescriptorIsOpen_nid_no_patchis a plain C++ function inlibkernel(notextern "C"), so it is not exported by the patchedlibkernel.prxandlibkernel_sys.prxfails to load (undefined symbol: _Z29DescriptorIsOpen_nid_no_patchi,patched_librariesfails;guest_kernel_sysdoes not catch it because it loads the unpatched PRXs). Validate the descriptor with somethinglibkernel_sysalready reaches, asfchowndoes:GuestFstat(fd) != 0on Windows and::fstat(fd, &status) != 0on Linux, returningEBADF. The test's closed/invalid descriptor cases already cover it.Once it builds and
patched_librariespasses, this looks good to merge.Pull request closed