Repository navigation
feat(libc): export the versioned std::__sce_v2 filesystem primitives - #10989
Conversation
Progress report (e67cc81 → 72775e6)📈 System libraries: 26.24% (+0.01%, +5 implemented, +2 declared functions) ✅ 5 implemented
🆕 2 declared as stubs
Changed libraries (implemented exports)
|
MarcZX10
left a comment
There was a problem hiding this comment.
Requesting one blocking fix before merge: the new GuestFilesystem::StatType helper is compiled into the base libc by VersionedFilesystem.cpp, but it calls stat_nid_postfix, which is declared in prx/libkernel/include/Api.hpp and defined in libkernel/File/src/Stdio.cpp. The base libc target does not link libkernel; only the other PRX targets do (see core/libs/CMakeLists.txt). This leaves an unresolved kernel symbol in the Windows libc.prx link. 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.cpp leaves stat_nid_postfix undefined. MinGW also rejects a shared-library link with an unresolved symbol. Please keep the kernel-dependent stat operation in a target that already links libkernel, 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.
|
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.
Some 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.
|
21e3fba to
e17ffc2
Compare
|
Rebased onto While verifying this branch with a clean build I found that the previous head broke the default build whenever in Linking Verification on the rebased head:
|
MarcZX10
left a comment
There was a problem hiding this comment.
The head addresses my earlier stat_nid_postfix link concern: VersionedFilesystem.cpp now uses host filesystem status instead, and the compiled object has no undefined stat_nid_postfix reference.
One blocking semantic issue remains in the new StatType error branch. When std::filesystem::status sets failure, the code always returns TypeNotFound (lines 46–52). The existing GuestFilesystem::StatType contract returns TypeNotFound only for NoSuchFile, NotDirectory, Invalid and NameTooLong; other failures return TypeNone. Therefore errors such as permission denied or a symlink loop are currently reported as “not found” even though errno carries another error. Please use IsNotFound(code) to choose between TypeNotFound and TypeNone after mapping the failure, and add a regression for a non-not-found status error 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.
|
Windows confirmation of the fix. WinLibs MinGW-w64 GCC 15.2.0 (ucrt-posix-seh r7), Release, Windows 11 Home 10.0.26200:
Not run: a title. AI-assisted: yes (Claude Code) |
e17ffc2 to
a6fb580
Compare
|
Pushed The Regression: Verification:
Could you re-review when you have a moment? |
|
Windows run of head
AI-assisted: yes (Claude Code); results above were run on this machine. |
16f5071 to
a2a18bd
Compare
|
Pushed
|
|
A Windows rerun of the new head
AI-assisted: yes (Claude Code) |
|
Rebased onto current |
a2a18bd to
73cc10b
Compare
|
@edubox A Windows rerun of the rebased head
AI-assisted: yes (Claude Code) |
73cc10b to
518d291
Compare
|
Rebased onto current |
518d291 to
a93848d
Compare
74ce435 to
a70b1ec
Compare
|
Rebased onto current |
|
Watchdog status on The two should-fix items from the 2026-10-28 review remain addressed on this head ( AI-assisted: yes |
|
@edubox thanks, the versioned
|
|
@oneandonlydean done. Verified on this exact head (Linux x86-64, GCC 16.2.1, Release):
The AI-assisted: yes |
|
Watchdog status on
|
|
Watchdog re-check on
|
|
Watchdog re-check on
AI-assisted: yes |
|
Watchdog re-check on
AI-assisted: yes |
|
Watchdog status on approved head
Nothing is pushed. |
_Stat now resolves the guest path and reads the type and permissions through the host filesystem, so libc.prx no longer imports stat_nid_postfix from libkernel.prx. That import broke every host target that links only libc.prx (agc_shader_replay, agc_shader_replay_requests, host_libstdcxx_exception and the libc test executables) with an undefined reference to stat_nid_postfix. Types, permission bits and guest errno keep matching stat_nid_postfix, which guest_sce_v2_filesystem still cross-checks.
ff3783f to
72775e6
Compare
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)