feat(libSceLibcInternal): implement the wide std::_Fiopen #23846
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23846"
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 GiannisG1 on 2026-11-19T19:08:19Z.
What
std::_Fiopen(const wchar_t*, ios_base::openmode, int)(inventory 246, NIDaqyjhIx7jaY) was a parameterless placeholder that threw.basic_filebuf<..>::opencalls it for a wide file name, and so dobasic_ifstream/basic_ofstreamconstructed from one.It now follows Dinkumware V6.50's
fiopen.cpp, the same mirror the library already cites:wcstombsinto aFILENAME_MAX(1024-byte, FreeBSD) buffer;_Fiopenalready in libc, so its mode table and itsatehandling apply.Where Dinkumware would pass a name that fills the buffer on unterminated, this throws. A null name throws too. The guest
wcstombsencodes every 16-bit unit, so its failure path is kept but not reached.The mangled name hashes to the inventory NID (
tools/nid_names.py), so the export is named and the placeholder is gone. The new header is included by the library umbrella. The debt fragment removes the table row and adds a Functional entry: not verified on a console.Tested
Linux Mint 22.3, GCC 13.3.0, Release, head on
maine4cee4952b.guest_libc_internal_wide_fiopen:_Fiopenrefuses (in | trunc) returns null, and so does a missing file opened for input;std::invalid_argument.main: the test does not link, because the export does not exist there (the NID reaches the throwing placeholder). This PR: passes 3/3.tools/suite.py) on this branch: GPU tests on a GTX 1050 Ti (NVIDIA 580.178.04), an HD 630 (Mesa 25.2.8 ANV) and llvmpipe 25.2.8, everything else once.guest_libc_internal_wide_fiopenandpublic_headerspass.mainbaseline (HD 630 10, llvmpipe 3) plusagc_driver_pm4_order_signalon all three. That test checks for a median below 0.1 ms and does not load libSceLibcInternal. Interleaved with amaine4cee4952bbuild, 5 runs per GPU, both builds failed 7 of 15.NotImplemented_nid_no_patchtostd::invalid_argument, since they are invalid arguments, not unimplemented paths, andtools/progress.pycounts a reachableNotImplementedas a stub. On that tree,public_headersand its compile tests, everyguest_libc_internal_*test and the conventions and checker tests (344) pass.progress.py --module libSceLibcInternalno longer lists the export as pending.check_conventions.py,check_test_registration.py,check_main_sync.py(merges cleanly),check_compile.pyanddebt_fold.py --checkare clean.pr_overlap.py --branch: #17300 (rename-only) names the same alias. #13778, #14834, #17300, #18135 and #21704 could not be compared because they conflict withmain. A trial merge with each adds no conflicting file beyond those it already has. It merges cleanly with #23809 and #23837.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T19:30:04Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
1c23feaf49:tools/check_conventions.pypassed.guest_libc_internal_wide_fiopen_testsbuilt cleanly.guest_libc_internal_wide_fiopen):core/libs/prx/libSceLibcInternal/InventoryExports.cpp,core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp,core/libs/prx/libSceLibcInternal/libSceLibcInternal.hpp,core/libs/prx/libSceLibcInternal/Fiopen.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me