feat(libc): export the versioned std::__sce_v2 filesystem primitives #10989
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10989"
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 edubox on 2026-10-25T12:28:46Z.
What
The
std::__sce_v2filesystem primitives are missing fromlibc.prx. PPSA28416 imports all seven from it (_StatPr1S2l2SpPE,_Open_dirXQgLZdwqACM,_Read_dirYaXPSk7yIqY,_Close_dir2voXFbF1zkU,_Current_get3y6Rg-iaDY8, and the two_Xfilesystem_erroroverloadsPA+HkSsicW8/MxYQlfxPQzY).libSceLibcInternal/Filesystem.cppintolibc/include/GuestFilesystemPrimitives.hpp; the unversioned exports keep their behaviour andguest_libc_filesystemstill passes._Statcannot use that shared helper: it callsstat_nid_postfix, which onlylibkernel.prxdefines, and alibkernelimport inlibc.prxmakes every host target that links onlylibc.prxfail to link (agc_shader_replay,agc_shader_replay_requests,host_libstdcxx_exceptionand the libc test executables). The versioned_Statresolves the guest path and reads the type and permission bits with the host filesystem instead;guest_sce_v2_filesystemstill cross-checks type, permission bits anderrnoagainststat_nid_postfix.libc/src/VersionedFilesystem.cpp. The console'slibc.prxbundled with PPSA28416 shows the same semantics:_Stat(0xcb9b0, 0xd7 bytes) maps the type fromst_modeand keeps the same four not-found errors,_Open_dir(0xcb640, 0xe9) and_Read_dir(0xcb730, 0x15b) filter dot entries and report file type 8,_Close_dir(0xcb890, 0x2b) closes the handle, and_Current_get(0xcb8c0, 8) writes "/" and returns true. The versioned_Current_getuses that measured value; the unversioned call still returns the current directory._Xfilesystem_erroroverloads asNotImplemented_nid_no_patch, like the unversioned pair, so the imports resolve;std::__sce_v2::filesystem_errordoes not exist yet.guest_sce_v2_filesystemtest (GuestSceV2Filesystem.cpp) covers stat types and permission bits, missing paths, empty and missing directories, entry enumeration, close, and the two-byte "/" write of_Current_get.Tested
ctest --test-dir build -R 'guest_sce_v2_filesystem|guest_libc_filesystem'→ 2/2 passed.nid_patcher libcon the builtunpatched/libc.prxexports all seven NIDs (Pr1S2l2SpPE,XQgLZdwqACM,YaXPSk7yIqY,2voXFbF1zkU,3y6Rg-iaDY8,PA+HkSsicW8,MxYQlfxPQzY).libc.prxbundled with PPSA28416 (disassembly; sizes and offsets above).sceNpGetSandboxInfoand still imports the versioned locale exports, so these calls were not reached at runtime.ninja(2992 targets) andctest -j16(2218 tests) on the rebased head: 2217 passed. The only failure isprogress_history, which asserts the English git message and fails under a Spanish locale; it passes withLC_ALL=C.python3 tools/check_conventions.py --base origin/mainpasses.tools/pr_overlap.py --branch feat/libc-sce-v2-filesystem --jobs 32: no PR exports the same NIDs or creates the same files; the only shared file isdocs/dev/debt/libc.md(textual append).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)libc.prxexports; the 15 versioned locale exports remain)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T12:35:54Z.
Review: CHANGES_REQUESTED
Requesting one blocking fix before merge: the new
GuestFilesystem::StatTypehelper is compiled into the baselibcbyVersionedFilesystem.cpp, but it callsstat_nid_postfix, which is declared inprx/libkernel/include/Api.hppand defined inlibkernel/File/src/Stdio.cpp. The baselibctarget does not linklibkernel; only the other PRX targets do (seecore/libs/CMakeLists.txt). This leaves an unresolved kernel symbol in the Windowslibc.prxlink. The PR reports no Windows build, and the hosted Windows job here is only the relinker job, not the libc product build.I confirmed the changed source files pass C++20 syntax checks, but a MinGW object compile of
VersionedFilesystem.cppleavesstat_nid_postfixundefined. MinGW also rejects a shared-library link with an unresolved symbol. Please keep the kernel-dependent stat operation in a target that already linkslibkernel, or provide a Windows link arrangement that resolves it without introducing a target cycle, and validate the Windows libc link/test before resubmitting.My exact-head local checks were
check_conventions.py,git diff --check, and syntax checks for both filesystem exports and the new test; those passed. They do not cover this link dependency.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T13:54:50Z.
Review: DISMISSED
The head addresses my earlier
stat_nid_postfixlink concern:VersionedFilesystem.cppnow uses host filesystem status instead, and the compiled object has no undefinedstat_nid_postfixreference.One blocking semantic issue remains in the new
StatTypeerror branch. Whenstd::filesystem::statussetsfailure, the code always returnsTypeNotFound(lines 46–52). The existingGuestFilesystem::StatTypecontract returnsTypeNotFoundonly forNoSuchFile,NotDirectory,InvalidandNameTooLong; other failures returnTypeNone. Therefore errors such as permission denied or a symlink loop are currently reported as “not found” even thougherrnocarries another error. Please useIsNotFound(code)to choose betweenTypeNotFoundandTypeNoneafter mapping the failure, and add a regression for a non-not-foundstatuserror where the host platform permits a deterministic fixture. The successful-path type and permission checks and the missing-path checks do not exercise this case.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T09:05:34Z.
Review: APPROVED
The exact current head fixes the previously reported StatType error-classification issue: failures are mapped through IsNotFound, and TestStatError covers a symlink loop as TypeNone with the original error and permissions preserved. The earlier stat-link concern is also addressed by resolving paths without a libkernel import, including app0.zar entries. The author reports the focused libc filesystem tests and full Linux Release suite passing apart from locale-sensitive progress_history (which passes with LC_ALL=C); conventions pass and the branch includes current main. I did not rerun those tests locally or test Windows/macOS or a title. No blocking issue remains in this review.