feat(libc): forward time resolution queries to the kernel #14620
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14620"
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 Danigamer05 on 2026-11-01T16:29:37Z.
What
Implement
timespec_getres(libc, NIDZvRHHCfA4HA) by forwarding base 1 to libkernel'ssceKernelClockGetreswith clock ID 0. Return 1 only when that provider succeeds; other bases return 0 without calling it or changing memory/errno. An absent provider throws instead of fabricating a resolution.The contract comes from PPSA03671 v01.001.005's bundled
libc.prx, SHA-256483961e086b8a1fffa8138b3c0badf798987fb5f35ec908d828946408be2d8a6, at RVA0x6D9E0: the original wrapper calls its importedsceKernelClockGetres. libc keeps an atomic registered callback, and libkernel registers its existing implementation when it loads. Memory validation, clock resolution and errno therefore come from the same provider as direct kernel calls.#13273 proposes a parameterless throwing
libSceLibcInternalinventory placeholder for the same name/NID, with unverified arguments and behavior. That is not an implementation and is not a dependency of this change. This PR supplies the typed libc behavior; it does not add the inventory placeholder. #6084 concerns the differenttimespec_getexport.Tested
Windows x86-64, WinLibs GCC 15.2.0, Release,
BUILD_TESTING=ON, mainf2d874c1fdccf781c0fa5d86619bb5dd8894b958. Exact tested head:906bf667bc94bf797b73579c08203610a9b5ba46.guest_timespec_getres_tests.public_headersand all fourguest_timespec_getres_{unsupported,forwarding,errors,integration}cases. They cover unsupported bases with inaccessible output, forwarded pointer/clock ID, signed provider errors and errno, null output, surrounding sentinels and extreme 64-bit fields, and calls through the actually loaded kernel.Not tested: Linux, macOS, another SDK, a game, GPU or console. No speed or game compatibility claim. No original binary or extracted bytes, notes or logs are committed.
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 CnRJay on 2026-11-01T19:48:51Z.
Review: COMMENTED
Withdrawn. This review applied a title-ID/log requirement that is not in CONTRIBUTING (
Unblocks: noneis allowed), and it contained no code review.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:55:34Z.
Review: COMMENTED
Reviewed — no blocking findings
timespec_getresfollows the bundled wrapper as its debt entry describes: base 1 forwards tosceKernelClockGetreswith clock 0, and the result is 1 exactly when that call returns 0; any other base returns 0. The NID isZvRHHCfA4HA, which matches the repo's NID tool. The four guest test modes (unsupported,forwarding,errors,integration) all passed in the hosted Windows CTest run. The console behaviour is not measured, as the debt entry says.What I ran
906bf667bc94bf797b73579c08203610a9b5ba46; basef2d874c1fdccf781c0fa5d86619bb5dd8894b958. 7 files, +174/-0:libc/src/Time.cpp(the function and registration),libc/include/Api.hppandGeneral.hpp(declarations),libkernel/Time/Time.cpp(the registration at static initialisation),libc/CMakeLists.txt(four test modes), the newtests/GuestTimespecGetres.cpp, anddocs/dev/debt/libc.md.NotImplemented_nid_no_patchwhen nothing is registered.tools/nid_names.pycompute_nid('timespec_getres')returnsZvRHHCfA4HA, the NID in the debt entry.mainand the modes' assertions (lines 52-121 at head).passed_with_warningswith three findings (definition-not-foundandnid-alias-differs-from-symbol-hash), none abouttimespec.guest_timespec_getres_unsupported,_forwarding,_errorsand_integration(all Passed).Results
libc/src/Time.cpplibc/src/Time.cppZvRHHCfA4HAtools/nid_names.pyNotImplemented_nid_no_patch; covered by theunsupportedmodeguest_timespec_getres_*cases passedtimespecRead-only check output
Precheck was not run: no PR-head code is run here. ABI audit:
passed_with_warnings(1448 symbols; 3 findings, none abouttimespec). Hosted:gh api repos/boykopovar/AnyPS5/commits/906bf667bc94bf797b73579c08203610a9b5ba46/check-runs.Negative control
Not run here. A negative control needs a build, and code from this head is not run here.
Findings
Blocking
None.
Non-blocking
None.
Sources
github.com/boykopovar/AnyPS5@906bf667bc/core/libs/prx/libc/src/Time.cppgithub.com/boykopovar/AnyPS5@906bf667bc/core/libs/prx/libkernel/Time/Time.cppgithub.com/boykopovar/AnyPS5@906bf667bc/docs/dev/debt/libc.mdNot verified
To get this to a good state