feat(libSceLibcInternal): implement the atomic wait deadline helpers #16146
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16146"
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 Ducengarth on 2026-11-05T18:45:56Z.
What
Implement
__std_atomic_wait_get_deadlineand__std_atomic_wait_get_remaining_timeoutinlibSceLibcInternal, replacing their parameterless throwing placeholders inRecoveredInventory.cpp. They are the deadline helpers of the STL's timed atomic waits.__std_atomic_wait_get_deadline(timeout)returns the current time in milliseconds plustimeout, wrapping as unsigned arithmetic. Atimeoutof0xFFFFFFFFFFFFFFFFreturns that same no-deadline value.__std_atomic_wait_get_remaining_timeout(deadline)returns0xFFFFFFFF(no timeout) for no deadline, 0 once the deadline has passed, and otherwise the milliseconds left, capped at 864000000 (ten days).Source: Microsoft STL at
e1ed302, with the no-deadline value here and the no-timeout value inxatomic_wait.h.GetTickCount64on Windows, as in that source, andCLOCK_MONOTONICin milliseconds on POSIX; a failed POSIX clock query throws. The console's clock and epoch are unverified. This clock choice comes from #16145 and #16148.unsigned longis 64 bits in the PS5 ABI and 32 bits in that source. Every returned value fits in 32 bits, so a caller reading either width gets the same number.Scope: this does not make timed atomic waits work in a title.
__std_atomic_wait_direct_8,__std_atomic_wait_direct_16and__std_atomic_notify_multi_directstill throw, because no source I found gives their signatures, and they are not touched here.No title's trace or disassembly was used, and neither export was measured on a PS5. The gap is recorded in
docs/dev/debt/libSceLibcInternal.md. The placeholder count there goes from 40 to 38, while the physical-module map still assigns all 40 inventory NIDs to the module. This consolidates #16145 and #16148, opened by MarrasFederico within a minute of this one, which implement one helper each; as agreed there, those two close as duplicates once this one is reconciled.pr_overlapreports no other pull request with the same exports or new files. It does report line conflicts, mainly in that count (#15460, #15577, #15581 and others) and in neighbouring placeholders (#15657), so whichever merges second has to resolve them. I will rebase this one as needed. Seven pull requests that already conflict withmaincould not be compared by the tool (#5021, #13486, #13778, #13782, #14212, #14664, #15899); their diffs do not mention these helpers.Tested
Windows 11, MinGW-w64 GCC (WinLibs), Release build. No title or homebrew, and not built on Linux.
guest_libc_internal_atomic_wait_deadline(new) passes 3 runs out of 3 at the current head. It covers the no-deadline and no-timeout values, a zero timeout, a deadline expiring after a sleep, unsigned wrap, and the ten-day cap above, at and below the limit. The deadline and the time left are bounded by the test's ownGetTickCount64/CLOCK_MONOTONICreadings taken before and after each call, taken from #16145 and #16148.std::chrono::steady_clock, removing the cap, the no-deadline check or the expiry check each made the test fail with the matching message. These mutations were not repeated after the clock change.ctest --parallel 5 -E '^guest_thermal_sensors$'(that test hard-freezes this PC, see #16061): of 4209 tests, 3316 pass, 884 skip and 9 fail. The skips include 867 AGC tests, which this build leaves out withANYPS5_AGC_EXECUTION_TESTS. Of the 9 failures, 4 pass when re-run alone (select_tests_SelectArgumentTests, onetrace_digesttest,agc_graphics_profile_draw,guest_timed_wait_cpu). The other 5 are in Python tooling tests this change does not touch:test_registrationandselect_tests_MissingCommandTests(os.symlinkneeds a privilege this account lacks),debt_split(temp folder inside the repository),title_run(a window-ordering check) and onetrace_digesttimeout. They were not compared withmain.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