feat(libkernel): fail unknown clock ids 16 to 31 with EINVAL on request #15656
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/15656"
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 XatiX on 2026-11-04T00:24:51Z.
What
clock_gettimeandclock_getresthrow for the clock ids 16 to 31 that are not implemented, since a PS5 may define them (#14618 kept that range throwing).APS5_FAIL_UNKNOWN_CLOCKSmakes them fail withEINVALinstead, as FreeBSD'skern_clock_gettimedoes for an unknown id, so a caller with a fallback can go on. Without it nothing changes.PlayFab Party (
Party.prx, shipped by PPSA18653) reads clock 20 for a timestamp (0x29be26) and falls back togettimeofday, thentime, when the call fails. Its sibling function reads clock 0, so clock 20 is a wall clock that the SDK lets fail, like the PS4 network clocks 16 to 19. No public source names id 20. A measurement on a PS5 (whatclock_gettime(20)andclock_getres(20)return there, and for 16 to 19) would settle it; it is recorded in technical debt.guest_freebsd_clockschecks that ids 16, 20 and 31 still throw by default, fail withEINVAL(0x80020016fromsceKernelClockGettime) for both calls with the variable set, leave the result untouched, and that id 3 still throws and clock 0 still reads.Tested
guest_freebsd_clocks: 3/3 pass with the change, 3/3 fail onmain.ctest -R "clock|time": 130/130 pass.main1c8c0efc8c(headc100fdc57c):guest_freebsd_clockspasses again, includingUnknownClocksFailOnlyWhenRequested.EINVAL: Party takes itsgettimeofdayfallback, theclock_gettime: unsupported clock_id 20abort at about 50 s is gone, and the title reaches its first-run preferences screen (at about 0.14 FPS, the next blocker).tools/check_conventions.pypasses.tools/pr_overlap.py --branchreports neighbouring edits only, and a merge keeps both: #12418 (EFAULT for an unwritable result) atTime.cppL637-638, and #12544 and #15064 atENVIRONMENT.mdL661.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)APS5_FAIL_UNKNOWN_CLOCKS=1)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by BunnyFl on 2026-11-04T01:35:35Z.
Review: APPROVED
@XatiX thanks. The default is unchanged: ids 16 to 31 still throw unless
APS5_FAIL_UNKNOWN_CLOCKSis set (Time.cpp:84-86). The opt-in failure is FreeBSD'sEINVALfor an unknown id, returned before the result is written. The debt entry states plainly that the PS5's answer for ids 16 to 20 isn't measured.clock_getreswith a null result still returns 0 before the new check (Time.cpp:642), which matches FreeBSD 11.4'ssys_clock_getresreturning 0 for a nulltpbefore it validates the id (kern_time.c).What I ran: head
c100fdc57c(it fast-forwards ontomain1c8c0efc8c), Windows 11, WinLibs GCC, Release:clockpass (7 of 7),guest_freebsd_clocksincluded;Time.cpptaken frommainwith the new test kept:guest_freebsd_clocksaborts (0xc0000409), 6 of 7 pass;tools/check_conventions.py --base upstream/mainon the head: all checks passed;tools/pr_overlap.py --branch: only neighbouring lines indocs/dev/ENVIRONMENT.mdanddocs/dev/debt/libkernel.md. #15035 couldn't be compared (it conflicts withmain); it changessettimeofdayandclock_settime, not these two calls.Approving.
Pull request closed