feat(libkernel): implement pthread_attr_setsolosched_np #2658

Closed
KaavayGupta wants to merge 1 commit from upstream-pr/2658 into main
KaavayGupta commented 2026-10-10 10:16:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by KaavayGupta on 2026-10-10T10:16:01Z.


What

In core/libs/prx/libkernel/Pthread/src/Attr.cpp, solo-scheduling attribute storage (_solosched) and its native SCE getter/setter (scePthreadAttrGetsolosched / scePthreadAttrSetsolosched) were already implemented. However, the POSIX alias pthread_attr_setsolosched_np in core/libs/prx/libkernel/Pthread/Posix/Attr.cpp was only added as a parameterless throwing stub in commit e91fe0f0 to unblock dynamic loading for LEGO Horizon Adventures (PPSA14632).

This change implements pthread_attr_setsolosched_np with its proper signature (PthreadAttr* attr, int solosched), validates the attribute handle using Valid(attr) (returning GUEST_EINVAL on invalid handles), and sets (*attr)->_solosched, matching the pattern of sibling POSIX attribute setters in that file.

Tested

Added test coverage in GuestPthreadAttr:

  • Verified passing nullptr or an uninitialized attribute handle returns EINVAL (22)
  • Verified default initialized solosched value is 0
  • Verified setting solosched to 1 succeeds (0) and is reflected via scePthreadAttrGetsolosched
  • Verified resetting solosched to 0 succeeds and is reflected via scePthreadAttrGetsolosched
  • Verified calling with a destroyed attribute handle returns EINVAL (22)
  • Ran python tools/check_conventions.py --base origin/main (passed)

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 in TechnicalDebt
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4810458719 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2658). Originally posted by [KaavayGupta](https://github.com/KaavayGupta) on 2026-10-10T10:16:01Z. --- ### What In `core/libs/prx/libkernel/Pthread/src/Attr.cpp`, solo-scheduling attribute storage (`_solosched`) and its native SCE getter/setter (`scePthreadAttrGetsolosched` / `scePthreadAttrSetsolosched`) were already implemented. However, the POSIX alias `pthread_attr_setsolosched_np` in `core/libs/prx/libkernel/Pthread/Posix/Attr.cpp` was only added as a parameterless throwing stub in commit e91fe0f0 to unblock dynamic loading for LEGO Horizon Adventures (PPSA14632). This change implements `pthread_attr_setsolosched_np` with its proper signature `(PthreadAttr* attr, int solosched)`, validates the attribute handle using `Valid(attr)` (returning `GUEST_EINVAL` on invalid handles), and sets `(*attr)->_solosched`, matching the pattern of sibling POSIX attribute setters in that file. ### Tested Added test coverage in `GuestPthreadAttr`: - Verified passing `nullptr` or an uninitialized attribute handle returns `EINVAL` (22) - Verified default initialized `solosched` value is 0 - Verified setting `solosched` to 1 succeeds (0) and is reflected via `scePthreadAttrGetsolosched` - Verified resetting `solosched` to 0 succeeds and is reflected via `scePthreadAttrGetsolosched` - Verified calling with a destroyed attribute handle returns `EINVAL` (22) - Ran `python tools/check_conventions.py --base origin/main` (passed) ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
github-actions[bot] commented 2026-10-10 10:16:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T10:16:22Z.


Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6096477666 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/2658#issuecomment-6096477666). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-10T10:16:22Z. --- Thank you for your interest in the project! We are sorry, but we cannot accept more PRs while we work through the existing backlog. This PR has been automatically closed and labeled "intake paused". This is not a judgment of the quality of your changes.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!2658
No description provided.