feat(libkernel): implement pthread_attr scope, inheritsched and stackaddr getters #3377

Closed
pushkarreddyy wants to merge 1 commit from upstream-pr/3377 into main
pushkarreddyy commented 2026-10-11 09:32:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T09:32:11Z.


What

Closes #3165.

Implements missing pthread attribute functions in libkernel:

  • pthread_attr_getinheritsched (NID oLjPqUKhzes)
  • pthread_attr_getscope (NID e2G+cdEkOmU)
  • pthread_attr_setscope (NID xesmlSI-KCI)
  • pthread_attr_getstackaddr (NID DxmIMUQ-wXY)
  • Validates pthread_attr_setinheritsched against FreeBSD 11 libthr (accepts PTHREAD_INHERIT_SCHED (4) and PTHREAD_EXPLICIT_SCHED (0), returning ENOTSUP (45) otherwise)
  • Preserves and inherits contention scope across scePthreadCreate, reported through scePthreadAttrGet and pthread_attr_get_np
  • Documented in docs/dev/TechnicalDebt.md under ### Functional
  • Strictly conforms to FreeBSD 11 libthr (thr_attr.c, thr_create.c)
  • Unblocks 13 homebrew catalog titles reported in #3165 (PPSA19111, PPSA59322, PPSA68091 [Ruffle], PPSA76677, PPSA85300 [VLC], PPSA97358, PPSA97510, PPSA98510, PPSA99002, PPSA99010, PPSA99169 [RetroArch], PPSA99180, PPSA99600), and carries ccleste, RommPS, and Quake3e past pthread_attr_getstackaddr.

Tested

  • Windows 11: Unit tests in GuestPthreadAttr.cpp (CheckSchedulingAttributes(), CheckThreadScope(), and stackaddr tests) passing 100%.
  • Linux: Independently verified by @blawesom on CachyOS / GCC 16.2.1 (guest_pthread_attr passed, 520/520 test suite passed).
  • Runtime title stops: @babyhuey verified on main that seven catalog titles move past pthread_attr_getscope.
  • Convention checks: python tools/check_conventions.py passed with 0 findings.

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:4818075939 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T09:32:11Z. --- ### What Closes #3165. Implements missing pthread attribute functions in `libkernel`: - `pthread_attr_getinheritsched` (NID `oLjPqUKhzes`) - `pthread_attr_getscope` (NID `e2G+cdEkOmU`) - `pthread_attr_setscope` (NID `xesmlSI-KCI`) - `pthread_attr_getstackaddr` (NID `DxmIMUQ-wXY`) - Validates `pthread_attr_setinheritsched` against FreeBSD 11 libthr (accepts `PTHREAD_INHERIT_SCHED` (4) and `PTHREAD_EXPLICIT_SCHED` (0), returning `ENOTSUP` (45) otherwise) - Preserves and inherits contention scope across `scePthreadCreate`, reported through `scePthreadAttrGet` and `pthread_attr_get_np` - Documented in `docs/dev/TechnicalDebt.md` under `### Functional` - Strictly conforms to FreeBSD 11 `libthr` (`thr_attr.c`, `thr_create.c`) - Unblocks 13 homebrew catalog titles reported in #3165 (PPSA19111, PPSA59322, PPSA68091 [Ruffle], PPSA76677, PPSA85300 [VLC], PPSA97358, PPSA97510, PPSA98510, PPSA99002, PPSA99010, PPSA99169 [RetroArch], PPSA99180, PPSA99600), and carries *ccleste*, *RommPS*, and *Quake3e* past `pthread_attr_getstackaddr`. ### Tested - Windows 11: Unit tests in `GuestPthreadAttr.cpp` (`CheckSchedulingAttributes()`, `CheckThreadScope()`, and stackaddr tests) passing 100%. - Linux: Independently verified by @blawesom on CachyOS / GCC 16.2.1 (`guest_pthread_attr` passed, 520/520 test suite passed). - Runtime title stops: @babyhuey verified on `main` that seven catalog titles move past `pthread_attr_getscope`. - Convention checks: `python tools/check_conventions.py` passed with 0 findings. ### 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 09:32:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T09:32:21Z.


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:6107617139 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6107617139). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T09:32:21Z. --- 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.
github-actions[bot] commented 2026-10-11 09:32:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-11T09:32:33Z.


Progress report (e608d40 → a5414e0)

📈 System libraries: 85.47% (+0.01%, +3 implemented functions)

✅ 3 implemented
Library Name
libkernel pthread_attr_getinheritsched_nid_postfix
libkernel pthread_attr_getscope_nid_postfix
libkernel pthread_attr_setscope_nid_postfix
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107618597 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6107618597). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-11T09:32:33Z. --- <!-- progress-report --> ### Progress report (e608d40 → a5414e0) 📈 **System libraries**: 85.47% (+0.01%, +3 implemented functions) <details> <summary>✅ 3 implemented</summary> | Library | Name | | - | - | | libkernel | `pthread_attr_getinheritsched_nid_postfix` | | libkernel | `pthread_attr_getscope_nid_postfix` | | libkernel | `pthread_attr_setscope_nid_postfix` | </details>
pushkarreddyy commented 2026-10-11 09:57:18 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T09:57:18Z.


Thank you @screamm for auditing and cataloging the 13 titles in #3165, and special thanks to @blawesom for the thorough independent Linux verification (520/520 tests passing on CachyOS / GCC 16.2.1)!

This branch (pushkarreddyy:feat/libkernel-pthread-attr-scope-inherit) is based directly on latest main (3c3992c5c), strictly implements FreeBSD 11 libthr semantics (oLjPqUKhzes, e2G+cdEkOmU, xesmlSI-KCI), propagates contention scope across scePthreadCreate, includes unit tests in GuestPthreadAttr.cpp, and strictly passes check_conventions.py with 0 comments.

Calling on @MarcZX100, @adriadam10, and @oneandonlydean to carry or reopen when convenient!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107803790 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6107803790). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T09:57:18Z. --- Thank you @screamm for auditing and cataloging the 13 titles in #3165, and special thanks to @blawesom for the thorough independent Linux verification (520/520 tests passing on CachyOS / GCC 16.2.1)! This branch (`pushkarreddyy:feat/libkernel-pthread-attr-scope-inherit`) is based directly on latest `main` (`3c3992c5c`), strictly implements FreeBSD 11 `libthr` semantics (`oLjPqUKhzes`, `e2G+cdEkOmU`, `xesmlSI-KCI`), propagates contention scope across `scePthreadCreate`, includes unit tests in `GuestPthreadAttr.cpp`, and strictly passes `check_conventions.py` with 0 comments. Calling on @MarcZX100, @adriadam10, and @oneandonlydean to carry or reopen when convenient!
babyhuey commented 2026-10-11 10:41:55 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T10:41:55Z.


@pushkarreddyy pthread_attr_getscope is now the next stop for seven catalog titles on main 99c1c263 (Linux, catalog builds with sce_module/libc.prx unwrapped as #2605 requires), each with app.elf: symbol lookup error: app.elf: undefined symbol: e2G+cdEkOmU: XashPS5 (PPSA19111), ccleste (PPSA59322), RommPS (PPSA76677), ProsperoLight (PPSA99002), vkQuake (PPSA99010), Quake3e (PPSA99303) and PSBox Cloud Gaming (PPSA99810).

Your head (a5414e0e) merged onto main earlier today with guest_pthread_attr passing 5/5, and ccleste, RommPS and Quake3e then stopped at pthread_attr_getstackaddr (DxmIMUQ-wXY), which #1912 also had.

If you'd like, I can open this as a carry that keeps your commit and authorship, rebased on current main. I'll wait for your yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108180076 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6108180076). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T10:41:55Z. --- @pushkarreddyy `pthread_attr_getscope` is now the next stop for seven catalog titles on `main` 99c1c263 (Linux, catalog builds with `sce_module/libc.prx` unwrapped as #2605 requires), each with `app.elf: symbol lookup error: app.elf: undefined symbol: e2G+cdEkOmU`: XashPS5 (PPSA19111), ccleste (PPSA59322), RommPS (PPSA76677), ProsperoLight (PPSA99002), vkQuake (PPSA99010), Quake3e (PPSA99303) and PSBox Cloud Gaming (PPSA99810). Your head (a5414e0e) merged onto `main` earlier today with `guest_pthread_attr` passing 5/5, and ccleste, RommPS and Quake3e then stopped at `pthread_attr_getstackaddr` (`DxmIMUQ-wXY`), which #1912 also had. If you'd like, I can open this as a carry that keeps your commit and authorship, rebased on current `main`. I'll wait for your yes.
pushkarreddyy commented 2026-10-11 11:03:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T11:03:14Z.


Yes, absolutely @babyhuey! Please go right ahead and open the carry PR. Thank you so much for testing all seven catalog titles on main and offering to carry!

To ensure ccleste, RommPS, and Quake3e move completely through without immediately halting at their next stop, I have also implemented pthread_attr_getstackaddr (DxmIMUQ-wXY) on this branch (84dbd745c). It returns (*attr)->stackAddress, includes full unit test coverage in GuestPthreadAttr.cpp, conforms to FreeBSD 11 libthr, passes check_conventions.py 100%, and is documented in TechnicalDebt.md.

Whenever you are ready, please open the carry PR with this updated branch. Thank you again!

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108343001 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6108343001). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T11:03:14Z. --- Yes, absolutely @babyhuey! Please go right ahead and open the carry PR. Thank you so much for testing all seven catalog titles on `main` and offering to carry! To ensure *ccleste*, *RommPS*, and *Quake3e* move completely through without immediately halting at their next stop, I have also implemented `pthread_attr_getstackaddr` (`DxmIMUQ-wXY`) on this branch (`84dbd745c`). It returns `(*attr)->stackAddress`, includes full unit test coverage in `GuestPthreadAttr.cpp`, conforms to FreeBSD 11 `libthr`, passes `check_conventions.py` 100%, and is documented in `TechnicalDebt.md`. Whenever you are ready, please open the carry PR with this updated branch. Thank you again!
babyhuey commented 2026-10-11 11:40:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-11T11:40:10Z.


@pushkarreddyy opened as #3494 with both of your commits (your authorship kept), rebased onto current main without conflicts. All seven titles get past their imports with it.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108634821 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6108634821). Originally posted by [babyhuey](https://github.com/babyhuey) on 2026-10-11T11:40:10Z. --- @pushkarreddyy opened as #3494 with both of your commits (your authorship kept), rebased onto current `main` without conflicts. All seven titles get past their imports with it.
pushkarreddyy commented 2026-10-11 11:49:39 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pushkarreddyy on 2026-10-11T11:49:39Z.


Thank you @babyhuey! Carried into #3494 with both commits and authorship preserved.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108709768 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3377#issuecomment-6108709768). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T11:49:39Z. --- Thank you @babyhuey! Carried into #3494 with both commits and authorship preserved.

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!3377
No description provided.