feat(libSceLibcInternal): construct time_get and time_put facets #22528
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/22528"
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 MarrasFederico on 2026-11-17T19:01:36Z.
What
Implements nine libSceLibcInternal time-facet exports using the existing guest layouts and C-locale data:
time_get<wchar_t>:_Getcat(e5jQyuEE+9U), complete/base constructors taking refs (J2xO4cttypo,p-SW25yE-Q8) or_Locinfo(y0hzUSFrkng,bU3S1OS1sc0), and deleting destructor (8H3yBUytv-0). Construction fills the existing 0x30-byte facet;_Getcatreturns category 5, creates a facet only when requested, and releases its allocation if construction throws.time_put<char>: refs constructor (6htjEH2Gi-w),_Init(QdPT7uDTlo0) and deleting destructor (WQQlL0n2SpU)._Initcopies the existingTimeInforepresentation without changing the facet header; deleting destructors release the guest allocation.The three proposed new
time_put<wchar_t>constructors (oi3kpQPqpMY,b1LciG4lUUk,lOF5jrFNZUA) remain throwing stubs. Microsoft STL constructors call_Init; writing only a header would incorrectly report completed construction. The_Tnameslayout beyond +0x10 is not proved, sotime_put<wchar_t>::_Init(ZolDcuDSD0Q) also remains throwing. The preexisting wide refs constructor is unchanged.The source reference is Microsoft STL xloctime time_get and time_put, mapped to the existing
GuestLocale::FacetandTimeGetFields.cppguest layouts. Console behavior remains unverified and the C-locale restriction is recorded in the debt fragment.The current commit is based on
mainat0ad217899d0d6a917abb551149e7f15b471fd32dand includes the parsing changes from #22526 through that base.Tested
The author’s historical Linux run at
a324ee95b4d22f45bb4e74b8844e95bfee7fc1cfused x86-64, GCC 15.2.0, Release/Ninja. Console verification is outstanding.nice -n 19 cmake --build ../build --parallel 7 --target <target>forguest_libc_internal_time_get_fields_testsandguest_libc_internal_time_get_tests.ctest --test-dir ../build --output-on-failure -R '^guest_libc_internal_time_get': 2/2 passed after the corrections. Tests check constructor fields, full-width refs, guarded storage boundaries, allocation/deallocation, exception-safe_Getcat, preservation of_Init's header, direct and dynamic exported-symbol calls, and the excluded wide constructors/initializer still throwing._Getcatreturning 4 instead of 5 fails the new test; exact source restoration, recompilation and the positive test pass.git diff --checkpass.main, including dynamic export loading in the test harness.Checked on November 18, 2026: head
2711ac42bafbbd4cf48a9bf228fb2ae54b596ff9has a clean merge withmainat02650d94a5f171dc333d13fc5abed43faf440a1aand passesgit diff --check. An independent Windows 11 VM test report records 3/3 runs of each time-get test atf0c7d81edd1204efba23485e463fbf577321737c. The current head includes further test coverage that checks_Getcatpreserves the existing facet pointer and leaves its ownership untouched.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 PrivacyOnion on 2026-11-17T19:04:12Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
a324ee95b4:tools/check_conventions.pypassed.guest_libc_internal_time_get_fields_testsbuilt cleanly.guest_libc_internal_time_get_fields):core/libs/prx/libSceLibcInternal/InventoryExports.cpp,core/libs/prx/libSceLibcInternal/TimeGetFields.cpp,core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp,core/libs/prx/libSceLibcInternal/include/TimeGetFields.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-17T19:19:55Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this; the points below are optional.
What I ran
a324ee95b4d22f45bb4e74b8844e95bfee7fc1cf. I did not build or run tests, and I did not check the merge againstmain.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceLibcInternal/TimeGetFields.cpp:531—ConstructWideTimeGetFromLocinfochecks thatinfois not null and then never reads it. The two_Locinfoconstructors therefore accept any locale and return C-locale data without an error.ConstructWideTimeGetFacetat line 527 rejects a non-C name throughScopedClassicLocinfo, so the two paths behave differently. The debt fragment says the facets "use C-locale data" but does not say that a non-C_Locinfois accepted silently. Smallest fix: throw for a non-C locale ifLocinfoStorageexposes the name, or state in the fragment that these constructors ignore the locale. No test covers a non-C_Locinfo.Sources
github.com/boykopovar/AnyPS5@a324ee95b4/core/libs/prx/libSceLibcInternal/TimeGetFields.cpp (L531-L533)_Getcatpath:github.com/boykopovar/AnyPS5@a324ee95b4/core/libs/prx/libSceLibcInternal/TimeGetFields.cpp (L527)github.com/boykopovar/AnyPS5@a324ee95b4/docs/dev/debt/changes/feat-libcinternal-time-facet-ctors.md (L12)Not verified
ctest, the negative control, Windows and console behaviour were not run. The 2/2 result and the negative control are the author's report, not mine.files.jsonwas not read.APS5_EXPORTline, and neither does the existing wide constructor atTimeGetFields.cpp:550. I did not trace the export generation, and the author's public-header audit was not re-run.dlopenandLoadLibraryApath assumes libSceLibcInternal is a loadable shared module. I did not check the CMake target type.git merge-treecheck againstmainclaimed in the description.To get this to a good state
Nothing is required.
Optional: decide how the
_Locinfoconstructors should treat a non-C locale (see the finding above) and record the choice in the debt fragment.Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-17T19:43:16Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
f0c7d81edd:tools/check_conventions.pypassed.guest_libc_internal_time_get_fields_testsbuilt cleanly.guest_libc_internal_time_get_fields):core/libs/prx/libSceLibcInternal/InventoryExports.cpp,core/libs/prx/libSceLibcInternal/TimeGetFields.cpp,core/libs/prx/libSceLibcInternal/include/InventoryExports.hpp,core/libs/prx/libSceLibcInternal/include/TimeGetFields.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T00:46:44Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
f0c7d81edd1204efba23485e463fbf577321737cusing the prepared diff and the pinned repository reader (repo_read.py). No commands or tests were run; Linux test results and the negative control below were reported by the author.Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
Did not run the build, tests, negative control, Windows checks, or console behavior. The author reports Linux x86-64 GCC 15.2.0 Release/Ninja tests passed, including a negative control, but these results were not independently verified. No changed files were excluded: all seven files listed in the review manifest were read.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T09:31:20Z.
Review: COMMENTED
Reviewed — no blocking findings
The reviewed change at
fd3891035ddeaa83d18d0e780efe373abc649587has no verified blocking defects; tests and console behavior were not independently checked.What I ran
Read the prepared diff and targeted changed source at the pinned head. No commands or tests were run.
Results
Findings
Blocking
None.
Non-blocking
None.
Not verified
The full changed-file contents were not read;
review/filescontained no files, and repository files were only inspected in targeted ranges. Specifically,InventoryExports.cpp,InventoryExports.hpp, andGuestLibcInternalTimeGetFields.cppwere not read. The test/build claims, repository-wide export and debt checks, and console behavior were not independently verified. The manifest lists five changed files, all marked included; the diff also contains the debt fragment. No files were excluded in the manifest.To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T10:02:02Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the points below are optional.
What I ran
Reviewed head
2711ac42bafbbd4cf48a9bf228fb2ae54b596ff9usingrepo_read.pysearch and file reads. No build or tests were run in this review.Results
Findings
Blocking
None.
Non-blocking
time_get<wchar_t>constructors taking_Locinfovalidate the pointer but initialize the C-locale fields without reading it (core/libs/prx/libSceLibcInternal/TimeGetFields.cpp:769). This matches the stated C-locale limitation; consider retaining that limitation in user-facing documentation if callers can pass other locales.Not verified
The full texts of all six changed files were marked included in the manifest; targeted reads covered the changed implementation and test regions, export definitions, declarations, guest facet layouts, and CMake test registration. The entire contents of
InventoryExports.cpp,InventoryExports.hpp, and the test source were not read.files.jsonwas not available through the reader. No build, test, negative control, merge-preview, or console run was performed here. The description reports Linux build/tests and a negative control; those results were not independently verified.To get this to a good state
Nothing is required. Optionally document or test the behavior of
_Locinfoconstructors when given non-C locale data.