feat(libkernel): implement pthread_attr_setsolosched_np #3176

Merged
adriadam10 merged 2 commits from upstream-pr/3176 into main 2026-10-11 00:24:45 +00:00
adriadam10 commented 2026-10-11 00:12:08 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:12:08Z.


What

Carries @screamm's branch from #3148 (feat/libkernel-setsolosched-np, commit 7d7901b3 kept as is, with its authorship). Intake is paused for new contributors and the issue asks a maintainer to carry it.

pthread_attr_setsolosched_np (2+pVfgiEd7A) was a NotImplemented stub with no parameters, while its SCE twin scePthreadAttrSetsolosched is implemented. It now:

  • takes (pthread_attr_t*, int);
  • returns EINVAL (22) for a null or uninitialised attribute, like the other POSIX attribute setters;
  • stores the value through scePthreadAttrSetsolosched, so scePthreadAttrGetsolosched reads it back.

The signature follows the SCE twin (KytyPS5 PthreadAttrSetsolosched). The value isn't applied to host scheduling.

Title that stops on it on main: Returnal (PPSA01285 v03.000.005), with what(): pthread_attr_setsolosched_np_nid_postfix not implemented (#3148, also reported in #2872 and #1155). LEGO Horizon Adventures (PPSA14632) and Palworld (PPSA23126) import it too.

My commit only moves the TechnicalDebt line from the end of "Functional" to "Unknown function info", next to the other libkernel thread entries, since the signature is inferred from the twin.

Tested

  • Linux (CachyOS), GCC 16, Release: guest_pthread_attr passes. The test checks:
    • EINVAL for null, uninitialised and destroyed attributes;
    • the default is 0;
    • 1 and then 0 read back through scePthreadAttrGetsolosched.
  • On main the test stops on the NotImplemented throw.
  • Negative checks: each of these mutations makes the test fail: the value ignored, the value forced to 1, and the uninitialised-attribute check dropped.
  • @screamm ran it on Windows 11 with MinGW-w64 GCC 15.2.0 (#3148).
  • tools/check_conventions.py passes.

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 (attach them to this PR)
  • 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:4815391966 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3176). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:12:08Z. --- ### What Carries @screamm's branch from #3148 (`feat/libkernel-setsolosched-np`, commit `7d7901b3` kept as is, with its authorship). Intake is paused for new contributors and the issue asks a maintainer to carry it. `pthread_attr_setsolosched_np` (`2+pVfgiEd7A`) was a `NotImplemented` stub with no parameters, while its SCE twin `scePthreadAttrSetsolosched` is implemented. It now: - takes `(pthread_attr_t*, int)`; - returns `EINVAL` (22) for a null or uninitialised attribute, like the other POSIX attribute setters; - stores the value through `scePthreadAttrSetsolosched`, so `scePthreadAttrGetsolosched` reads it back. The signature follows the SCE twin (KytyPS5 `PthreadAttrSetsolosched`). The value isn't applied to host scheduling. **Title that stops on it on `main`:** Returnal (PPSA01285 v03.000.005), with `what(): pthread_attr_setsolosched_np_nid_postfix not implemented` (#3148, also reported in #2872 and #1155). LEGO Horizon Adventures (PPSA14632) and Palworld (PPSA23126) import it too. My commit only moves the TechnicalDebt line from the end of "Functional" to "Unknown function info", next to the other libkernel thread entries, since the signature is inferred from the twin. ### Tested - Linux (CachyOS), GCC 16, Release: `guest_pthread_attr` passes. The test checks: - `EINVAL` for null, uninitialised and destroyed attributes; - the default is 0; - 1 and then 0 read back through `scePthreadAttrGetsolosched`. - On `main` the test stops on the `NotImplemented` throw. - Negative checks: each of these mutations makes the test fail: the value ignored, the value forced to 1, and the uninitialised-attribute check dropped. - @screamm ran it on Windows 11 with MinGW-w64 GCC 15.2.0 (#3148). - `tools/check_conventions.py` passes. ### 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](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [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-11 00:12:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T00:12:28Z.


Progress report (942a174 → 8d90c1f)

📈 System libraries: 85.65% (+0.03%, +1 implemented functions)

✅ 1 implemented
Library Name
libkernel pthread_attr_setsolosched_np_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103635476 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3176#issuecomment-6103635476). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T00:12:28Z. --- <!-- progress-report --> ### Progress report (942a174 → 8d90c1f) 📈 **System libraries**: 85.65% (+0.03%, +1 implemented functions) <details> <summary>✅ 1 implemented</summary> | Library | Name | | - | - | | libkernel | `pthread_attr_setsolosched_np_nid_postfix` | </details>
Dextroid17 commented 2026-10-11 00:22:01 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T00:22:01Z.

Review: COMMENTED


Two things are worth separating here, because one of them is the reason this PR exists at all.

The implementation is right — and it is the one #3168 carried. The signature takes (pthread_attr_t*, int), a null or uninitialised attribute returns the guest EINVAL like the other attribute setters, and the value goes through scePthreadAttrSetsolosched so scePthreadAttrGetsolosched reads it back — the same three lines #3168 changed the same function to, byte for byte. With #3168 closed, this is the version of that change that is live.

This is the better of the two, in two specific ways, and both are worth keeping. The assertions are factored into a CheckSoloSched() case the way the other attribute tests are structured, and it adds a check the earlier one did not have: a destroyed attribute comes back GUEST_EINVAL as well. The debt line also moves out of "Functional" and into "Unknown function info" with the source links and the title evidence behind it, which is where someone asking "is this a real stop or a table row" will look. Carrying screamm's change with their authorship and putting the debt move in its own commit is the right division.

The EINVAL for an uninitialised attribute is the detail worth keeping. Valid(attr) rejecting both a null pointer and a null handle is what the neighbouring setters do, and the test's two rejected calls followed by a successful set-and-read is what shows the distinction instead of asserting it.

The acceptance bar is answered properly. Returnal reaching it with that exact what(): line, the two other titles that import it, and the cross-references to #2872 and #1155 give a reader everything needed to know this is a real stop — and the not-applied-to-host-scheduling limit is recorded where someone who later wonders why the value is stored but unused will find it.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5481317566 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3176#pullrequestreview-5481317566). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T00:22:01Z. **Review:** COMMENTED --- Two things are worth separating here, because one of them is the reason this PR exists at all. **The implementation is right — and it is the one #3168 carried.** The signature takes `(pthread_attr_t*, int)`, a null or uninitialised attribute returns the guest `EINVAL` like the other attribute setters, and the value goes through `scePthreadAttrSetsolosched` so `scePthreadAttrGetsolosched` reads it back — the same three lines #3168 changed the same function to, byte for byte. With #3168 closed, this is the version of that change that is live. **This is the better of the two, in two specific ways, and both are worth keeping.** The assertions are factored into a `CheckSoloSched()` case the way the other attribute tests are structured, and it adds a check the earlier one did not have: a destroyed attribute comes back `GUEST_EINVAL` as well. The debt line also moves out of "Functional" and into "Unknown function info" with the source links and the title evidence behind it, which is where someone asking "is this a real stop or a table row" will look. Carrying screamm's change with their authorship and putting the debt move in its own commit is the right division. **The `EINVAL` for an uninitialised attribute is the detail worth keeping.** `Valid(attr)` rejecting both a null pointer and a null handle is what the neighbouring setters do, and the test's two rejected calls followed by a successful set-and-read is what shows the distinction instead of asserting it. **The acceptance bar is answered properly.** Returnal reaching it with that exact `what():` line, the two other titles that import it, and the cross-references to #2872 and #1155 give a reader everything needed to know this is a real stop — and the not-applied-to-host-scheduling limit is recorded where someone who later wonders why the value is stored but unused will find it. Written with AI assistance.
adriadam10 commented 2026-10-11 00:25:03 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-11T00:25:03Z.


Merged with Linux CI red only on the three AGC tests that main has been failing since 3c46fa6f4 (agc_unit_shadow, agc_driver_flat_apertures, agc_driver_image_packed16_load, main run 38097151664). Windows passed, and guest_pthread_attr passed on both.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6103732014 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3176#issuecomment-6103732014). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-11T00:25:03Z. --- Merged with Linux CI red only on the three AGC tests that main has been failing since 3c46fa6f4 (`agc_unit_shadow`, `agc_driver_flat_apertures`, `agc_driver_image_packed16_load`, main run 38097151664). Windows passed, and `guest_pthread_attr` passed on both.
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!3176
No description provided.