Skip to content

feat(libkernel): implement pthread_condattr_getclock - #8010

Merged
adriadam10 merged 4 commits into
boykopovar:mainfrom
Piyush-Sagar:codex/implement-condattr-getclock
Oct 26, 2026
Merged

adriadam10 merged 4 commits into
boykopovar:mainfrom
Piyush-Sagar:codex/implement-condattr-getclock

Conversation

@Piyush-Sagar

@Piyush-Sagar Piyush-Sagar commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Add the missing libkernel pthread_condattr_getclock export (NID cTDYxTUNPhM). A live initialized attribute reports its stored signed 32-bit clock ID without changing the attribute or guest errno. Declare the getter in the shared libkernel API header and use the shared libc declarations in its regression test.

The signature and opaque handle follow the public PS5 payload SDK's pthread.h and _pthreadtypes.h; sys/_types.h supplies the 32-bit clock type. Valid-input behavior follows FreeBSD 11.4 libthr. This is public SDK/reference evidence; no PS5 hardware verification is claimed.

Null attribute pointers, null handles and null outputs call NotImplemented_nid_no_patch; their console error/fault behavior remains unverified. Inaccessible non-null pointers and copied dangling handles are not validated, and concurrent mutation/destruction is not synchronized. These gaps remain in docs/dev/debt/libkernel.md.

Getter regression coverage checks initialized defaults, both setters using clocks {0, 1, 2, Monotonic}, independent attributes, output canaries, unchanged handles/errno, and refusal of null arguments and original handles cleared by both destroy functions. Main's rejected-clock cases and SCE/POSIX pshared checks are preserved. After each rejected SCE and POSIX setter, the getter must report the previously stored Monotonic clock.

Dependency #9500 is merged. This branch is rebased onto main with its {0, 1, 2, 4} setter allowlist and rejection tests; the setter implementation is unchanged by this PR. Depends on: #9500 records the completed landing order.

Related prior work: closed, unmerged #3930 proposed this getter alongside additional SCE/pshared exports. This PR is limited to the POSIX getter.

Tested

Verified on 2026-10-26: Windows 11 Pro 10.0.26300, supported WinLibs MinGW-w64 GCC 15.2.0 r7 (x86_64-ucrt-posix-seh), Ninja, Release, BUILD_TESTING=ON, ANYPS5_RELINKER_ONLY=OFF. Head fd54e493dd4873e5d63bddbb614b6613637027eb is rebased onto main 518d36eaec0ac37870a17b465bedb5551be91b42, which includes #9500.

  • All patched system libraries and the five focused test targets rebuilt successfully.
  • Focused runtime tests: 5/5 passed, 0 failures, 2.86 seconds total: patched_libraries, guest_cond_timedwait, guest_pthread_condattr, guest_cond_recursive_mutex, guest_cond_unowned_mutex.
  • Registration audit: 1396 test executables, 0 built but unregistered, none new.
  • Public-header audit: 368 libraries, 12235 exports; unique declarations and umbrella coverage verified.
  • Conventions checks, including the PR title and description, and working-tree/committed-diff whitespace checks passed.
  • Overlap scan completed against main 427dd36164bbc1e7960c85c8e84dca75017c88f8. Its duplicate getter finding is this PR's previous head. Comparisons involving 35 other PRs' shared debt/header files could not complete because those PRs conflict with main; no clean-overlap claim is made.
  • Merge-tree checks against both the tested main base and the newer scan base were clean. The three changed source/header/test files are unchanged between those bases; the shared debt file has advanced.
cmake --build build-condattr --target libs guest_pthread_condattr_tests guest_cond_timedwait_tests guest_cond_recursive_mutex_tests guest_cond_unowned_mutex_tests patched_libraries_tests --parallel 6
ctest --test-dir build-condattr -R '^(guest_pthread_condattr|guest_cond_timedwait|guest_cond_recursive_mutex|guest_cond_unowned_mutex|patched_libraries)$' --output-on-failure
python3 tools/check_test_registration.py build-condattr
python3 core/libs/tests/test_public_headers.py --audit-only
python3 tools/check_conventions.py --base origin/main
python3 tools/check_conventions.py --base origin/main --title 'feat(libkernel): implement pthread_condattr_getclock' --body <PR-description-file>
git diff origin/main...HEAD --check
git diff --check
python3 tools/pr_overlap.py --branch codex/implement-condattr-getclock --repo boykopovar/AnyPS5 --jobs 8

The current refresh was not tested on Linux, on a PS5, or with a title; the full test suite was not run. No performance or game-unblocking claim is made. Full upstream Linux/Windows CI requires a maintainer-triggered Build workflow for PR 8010. The post-#9500 rebase and rejected-setter preservation checks are complete.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: fix(libkernel): reject clocks libthr does not accept in pthread_condattr_setclock #9500
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 4630 docs/dev/debt/libkernel.md
PR 5021 docs/dev/debt/libkernel.md
PR 6149 docs/dev/debt/libkernel.md
PR 6936 docs/dev/debt/libkernel.md
PR 7088 docs/dev/debt/libkernel.md
PR 7105 docs/dev/debt/libkernel.md
PR 7121 docs/dev/debt/libkernel.md
PR 7149 docs/dev/debt/libkernel.md
PR 7192 docs/dev/debt/libkernel.md
PR 7447 docs/dev/debt/libkernel.md
PR 7509 docs/dev/debt/libkernel.md
PR 7804 docs/dev/debt/libkernel.md
PR 8497 docs/dev/debt/libkernel.md
PR 8605 docs/dev/debt/libkernel.md
PR 9156 docs/dev/debt/libkernel.md
PR 9199 docs/dev/debt/libkernel.md
PR 9284 docs/dev/debt/libkernel.md
PR 9293 docs/dev/debt/libkernel.md
PR 9297 docs/dev/debt/libkernel.md
PR 9302 docs/dev/debt/libkernel.md
PR 9389 docs/dev/debt/libkernel.md
PR 9557 docs/dev/debt/libkernel.md
PR 9566 docs/dev/debt/libkernel.md
PR 9575 docs/dev/debt/libkernel.md
PR 9947 docs/dev/debt/libkernel.md
PR 10442 docs/dev/debt/libkernel.md
PR 10552 docs/dev/debt/libkernel.md
PR 10621 docs/dev/debt/libkernel.md
PR 11042 docs/dev/debt/libkernel.md
PR 11085 docs/dev/debt/libkernel.md
PR 11264 docs/dev/debt/libkernel.md
PR 11267 core/libs/prx/libkernel/include/Api.hpp
docs/dev/debt/libkernel.md
PR 11341 docs/dev/debt/libkernel.md

@MarcZX10

Copy link
Copy Markdown
Contributor

The overlap scan flags the GuestPthreadCondattr.cpp cases shared with #9500. Your getter regression currently stores clock IDs 5 and 12 and expects the getter to return them, while #9500 changes the setter to reject those IDs per FreeBSD libthr. Please coordinate with #9500’s author on which lands first and update the second PR’s test/checklist so both changes compose.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@Piyush-Sagar

Copy link
Copy Markdown
Contributor Author

@MarcZX10 Recorded the proposed landing order in this PR's description and checklist: #9500 first, then #8010 (Depends on: #9500). The exact test changes and local combined Windows verification are documented there. Coordination reply on #9500. Once #9500 merges, I'll rebase this branch, apply the prepared test update, preserve any intervening #8373 pshared checks, rerun verification, and push. The current GitHub branch is unchanged; the five passing tests were run on the separate local integration. AI-assisted.

@Piyush-Sagar
Piyush-Sagar force-pushed the codex/implement-condattr-getclock branch from 41e1024 to f5fa61d Compare October 25, 2026 11:56
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Oct 25, 2026
@Piyush-Sagar
Piyush-Sagar force-pushed the codex/implement-condattr-getclock branch from f5fa61d to fd54e49 Compare October 26, 2026 16:38
@Piyush-Sagar
Piyush-Sagar marked this pull request as ready for review October 26, 2026 16:38
@Piyush-Sagar

Copy link
Copy Markdown
Contributor Author

The post-#9500 refresh is pushed at fd54e493dd4873e5d63bddbb614b6613637027eb and this PR is ready for review. Rebased onto main 518d36eaec; retained the merged {0, 1, 2, 4} accepted-clock loop, rejected-clock cases, and SCE/POSIX pshared coverage. The getter now verifies that each rejected setter preserves the previously stored clock.

Windows verification on this head: all patched libraries rebuilt; all five focused runtime tests passed; registration (1396 executables), public-header audit (368 libraries / 12235 exports), conventions including PR metadata, and whitespace checks passed. The description includes the overlap scan's incomplete comparisons and the exact tested base.

Please trigger the full upstream Linux/Windows Build workflow for PR 8010 and review the refreshed diff. A maintainer with write access can run:

gh workflow run build.yml --repo boykopovar/AnyPS5 --ref main --field pr=8010

This account has no upstream write permission to dispatch that workflow. Full CI remains pending. AI-assisted.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 26, 2026
@adriadam10 adriadam10 self-assigned this Oct 26, 2026
@github-actions

Copy link
Copy Markdown

Progress report (041a2e1 → fd54e49)

➖ System libraries: 51.0% (+0.0%, +1 declared functions)

🆕 1 declared as stubs
Library Name
libkernel pthread_condattr_getclock_nid_postfix

Changed libraries (implemented exports)

Library Before After Change
libkernel 686/725 (94.62%) 686/726 (94.49%) -0.13 pp

@adriadam10
adriadam10 merged commit aec3b38 into boykopovar:main Oct 26, 2026
12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the NID, the signature and _clockid against Pthread.hpp and FreeBSD 11.4 libthr's _pthread_condattr_getclock. The getter test covers defaults, both setters, rejected clocks keeping the stored one, output canaries, errno and destroyed handles, and the debt entry is in place; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants