libkernel: pthread_attr_getinheritsched, pthread_attr_getscope and pthread_attr_setscope are absent imports of 13 catalog titles; fix branch ready #3165

Closed
opened 2026-10-10 23:50:32 +00:00 by screamm · 7 comments
screamm commented 2026-10-10 23:50:32 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-10T23:50:32Z.


libkernel does not export pthread_attr_getinheritsched, pthread_attr_getscope and pthread_attr_setscope (NIDs oLjPqUKhzes, e2G+cdEkOmU, xesmlSI-KCI, confirmed with tools/nid_names.py against aerolib). An import audit of the homebrew catalog on main 262c0316 (Windows, see my comment on #1578) lists all three as absent imports of 13 titles: PPSA19111, PPSA59322, PPSA68091 (Ruffle), PPSA76677, PPSA85300 (VLC), PPSA97358, PPSA97510, PPSA98510, PPSA99002, PPSA99010, PPSA99169 (RetroArch), PPSA99764 (Porpoise), PPSA99810 (PSBox). Each becomes a stop once the title's earlier stop (_umtx_op #1482, alarm #2765, execvp #2827) is passed; the closed #1912 was asked to return with such a log line.

Fix branch ready: screamm:feat/libkernel-attr-scope-inherit (3cbebab4, one commit on main 91b13413). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is.

  • After FreeBSD stable/11 libthr (thr_attr.c, thr_create.c, thr_init.c at 5ed7eb0d): scope defaults to system (2) and accepts only process (0) or system (2), otherwise, or for a null attr or null output, EINVAL; getinheritsched returns EINVAL for a null attr and throws for a null output, which libthr writes through unchecked; the default is PTHREAD_INHERIT_SCHED (4) as the existing scePthreadAttrInit already sets. The existing pthread_attr_setinheritsched now returns ENOTSUP (45) for values other than 4 or 0 as libthr does. A thread records its scope at creation (inherited from the creator under inherit-sched or taken from the attr), and pthread_attr_get_np and scePthreadAttrGet report it, which fixes the stale scope field a reviewer found on #1912. Process scope has no effect on host threads; recorded in TechnicalDebt with the rest.
  • guest_pthread_attr gains the defaults, round trips, invalid values leaving the stored value unchanged, null and destroyed attrs, the null-output cases, and the scope reported by both query paths for explicit and inherited scope.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: guest_pthread_attr 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 479/479; with main's Posix/Attr.cpp the extended test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux. The setinheritsched tightening is beyond the three exports and could be split out if preferred.

Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5796354482 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165). Originally posted by [screamm](https://github.com/screamm) on 2026-10-10T23:50:32Z. --- libkernel does not export `pthread_attr_getinheritsched`, `pthread_attr_getscope` and `pthread_attr_setscope` (NIDs `oLjPqUKhzes`, `e2G+cdEkOmU`, `xesmlSI-KCI`, confirmed with `tools/nid_names.py` against aerolib). An import audit of the homebrew catalog on `main` 262c0316 (Windows, see my comment on #1578) lists all three as absent imports of 13 titles: PPSA19111, PPSA59322, PPSA68091 (Ruffle), PPSA76677, PPSA85300 (VLC), PPSA97358, PPSA97510, PPSA98510, PPSA99002, PPSA99010, PPSA99169 (RetroArch), PPSA99764 (Porpoise), PPSA99810 (PSBox). Each becomes a stop once the title's earlier stop (`_umtx_op` #1482, `alarm` #2765, `execvp` #2827) is passed; the closed #1912 was asked to return with such a log line. **Fix branch ready:** [`screamm:feat/libkernel-attr-scope-inherit`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-attr-scope-inherit) (`3cbebab4`, one commit on `main` `91b13413`). I cannot open it as a PR because of the intake check; anyone eligible is welcome to carry it, keeping the commit as is. - After FreeBSD stable/11 libthr (`thr_attr.c`, `thr_create.c`, `thr_init.c` at `5ed7eb0d`): scope defaults to system (2) and accepts only process (0) or system (2), otherwise, or for a null attr or null output, `EINVAL`; `getinheritsched` returns `EINVAL` for a null attr and throws for a null output, which libthr writes through unchecked; the default is `PTHREAD_INHERIT_SCHED` (4) as the existing `scePthreadAttrInit` already sets. The existing `pthread_attr_setinheritsched` now returns `ENOTSUP` (45) for values other than 4 or 0 as libthr does. A thread records its scope at creation (inherited from the creator under inherit-sched or taken from the attr), and `pthread_attr_get_np` and `scePthreadAttrGet` report it, which fixes the stale scope field a reviewer found on #1912. Process scope has no effect on host threads; recorded in TechnicalDebt with the rest. - `guest_pthread_attr` gains the defaults, round trips, invalid values leaving the stored value unchanged, null and destroyed attrs, the null-output cases, and the scope reported by both query paths for explicit and inherited scope. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: `guest_pthread_attr` 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 479/479; with `main`'s `Posix/Attr.cpp` the extended test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux. The `setinheritsched` tightening is beyond the three exports and could be split out if preferred. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
pushkarreddyy commented 2026-10-11 09:32:30 +00:00 (Migrated from github.com)
Author
Contributor

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


Implemented and verified against FreeBSD 11 libthr and latest main (3c3992c5c) in #3377 (branch pushkarreddyy:feat/libkernel-pthread-attr-scope-inherit).

  • pthread_attr_getinheritsched (oLjPqUKhzes)
  • pthread_attr_getscope (e2G+cdEkOmU)
  • pthread_attr_setscope (xesmlSI-KCI)
  • pthread_attr_setinheritsched returns ENOTSUP on invalid inheritance
  • Contention scope propagation in scePthreadCreate, reported through scePthreadAttrGet and pthread_attr_get_np
  • Unit tests added to GuestPthreadAttr.cpp
  • Documented in TechnicalDebt.md under ### Functional
  • Passes ools/check_conventions.py 100% with 0 comments.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107618276 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6107618276). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T09:32:30Z. --- Implemented and verified against FreeBSD 11 libthr and latest main (3c3992c5c) in #3377 (branch pushkarreddyy:feat/libkernel-pthread-attr-scope-inherit). - pthread_attr_getinheritsched (oLjPqUKhzes) - pthread_attr_getscope (e2G+cdEkOmU) - pthread_attr_setscope (xesmlSI-KCI) - pthread_attr_setinheritsched returns ENOTSUP on invalid inheritance - Contention scope propagation in scePthreadCreate, reported through scePthreadAttrGet and pthread_attr_get_np - Unit tests added to GuestPthreadAttr.cpp - Documented in TechnicalDebt.md under ### Functional - Passes ools/check_conventions.py 100% with 0 comments.
blawesom commented 2026-10-11 09:52:53 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-11T09:52:53Z.


Independent verification on Linux (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, BUILD_TESTING=ON.

  • Rebased 3cbebab4 onto current main (the branch was 605 commits behind): one conflict in GuestPthreadAttr.cpp (main added a pthread_attr_setsolosched_np declaration where this branch declares its set; both kept) and one in docs/dev/TechnicalDebt.md (both entries kept); no implementation conflicts.
  • tools/check_conventions.py --base origin/main and git diff --check pass.
  • guest_pthread_attr passes.
  • Full suite mirroring the Windows run (ctest -j8 -E "^agc_driver_|^video_out_flip"): 520/520 passed.

The rebased branch is available at blawesom:verify/3165 for anyone carrying — the commit is otherwise unchanged.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107769749 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6107769749). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-11T09:52:53Z. --- Independent verification on **Linux** (the gap noted in the report): CachyOS, kernel 7.2.9, GCC 16.2.1, Ninja, Release, `BUILD_TESTING=ON`. - Rebased `3cbebab4` onto current `main` (the branch was 605 commits behind): one conflict in `GuestPthreadAttr.cpp` (main added a `pthread_attr_setsolosched_np` declaration where this branch declares its set; both kept) and one in `docs/dev/TechnicalDebt.md` (both entries kept); no implementation conflicts. - `tools/check_conventions.py --base origin/main` and `git diff --check` pass. - `guest_pthread_attr` passes. - Full suite mirroring the Windows run (`ctest -j8 -E "^agc_driver_|^video_out_flip"`): **520/520 passed**. The rebased branch is available at [`blawesom:verify/3165`](https://github.com/blawesom/AnyPS5/tree/verify/3165) for anyone carrying — the commit is otherwise unchanged.
pushkarreddyy commented 2026-10-11 09:57:19 +00:00 (Migrated from github.com)
Author
Contributor

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


Huge thanks to @blawesom for the independent Linux test verification (520/520 test suite pass) and to @screamm for the original investigation identifying the 13 catalog titles unblocked by these exports!

PR #3377 (pushkarreddyy:feat/libkernel-pthread-attr-scope-inherit) is submitted based on latest main (3c3992c5c), with clean pthread_attr_setsolosched_np integration, FreeBSD 11 libthr conformance, and in-section TechnicalDebt.md documentation. Ready for @MarcZX100 / @adriadam10 / @oneandonlydean to carry or merge.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6107803890 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6107803890). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T09:57:19Z. --- Huge thanks to @blawesom for the independent Linux test verification (520/520 test suite pass) and to @screamm for the original investigation identifying the 13 catalog titles unblocked by these exports! PR #3377 (`pushkarreddyy:feat/libkernel-pthread-attr-scope-inherit`) is submitted based on latest `main` (`3c3992c5c`), with clean `pthread_attr_setsolosched_np` integration, FreeBSD 11 `libthr` conformance, and in-section `TechnicalDebt.md` documentation. Ready for @MarcZX100 / @adriadam10 / @oneandonlydean to carry or merge.
screamm commented 2026-10-11 11:39:57 +00:00 (Migrated from github.com)
Author
Contributor

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


Title evidence on current main (0f863c10, Windows 11, WinLibs GCC 15.2.0 r7, Release, fresh relink with --windows --registry unused-filter=0): six catalog titles now have pthread_attr_getscope as their first stop, with the log line

FAIL: unresolved ELF import e2G+cdEkOmU from libkernel.prx

PPSA19111, PPSA59322, PPSA76677, PPSA99002, PPSA99010 and PPSA99810 (PSBox Cloud Gaming). Last night their first stops were _umtx_op, sceAudioInInit and friends, all merged since, so this is now the next stop on main for all six. The branch above (3cbebab4) and pushkarreddyy's #3377 both cover it; whichever is carried, this is the log line the merge rule asks for.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108633200 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6108633200). Originally posted by [screamm](https://github.com/screamm) on 2026-10-11T11:39:57Z. --- Title evidence on current `main` (`0f863c10`, Windows 11, WinLibs GCC 15.2.0 r7, Release, fresh relink with `--windows --registry unused-filter=0`): six catalog titles now have `pthread_attr_getscope` as their first stop, with the log line ``` FAIL: unresolved ELF import e2G+cdEkOmU from libkernel.prx ``` PPSA19111, PPSA59322, PPSA76677, PPSA99002, PPSA99010 and PPSA99810 (PSBox Cloud Gaming). Last night their first stops were `_umtx_op`, `sceAudioInInit` and friends, all merged since, so this is now the next stop on `main` for all six. The branch above (`3cbebab4`) and pushkarreddyy's #3377 both cover it; whichever is carried, this is the log line the merge rule asks for.
pushkarreddyy commented 2026-10-11 11:49:41 +00:00 (Migrated from github.com)
Author
Contributor

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


Thank you @screamm for the empirical log line validation on current main (

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6108709903 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6108709903). Originally posted by [pushkarreddyy](https://github.com/pushkarreddyy) on 2026-10-11T11:49:41Z. --- Thank you @screamm for the empirical log line validation on current main (
blawesom commented 2026-10-12 05:53:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by blawesom on 2026-10-12T05:53:01Z.


Implementation note for housekeeping: this issue's exports (pthread_attr_getinheritsched, pthread_attr_getscope, pthread_attr_setscope) landed on main via #3494 (merged 2026-10-11).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118586690 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6118586690). Originally posted by [blawesom](https://github.com/blawesom) on 2026-10-12T05:53:01Z. --- Implementation note for housekeeping: this issue's exports (`pthread_attr_getinheritsched`, `pthread_attr_getscope`, `pthread_attr_setscope`) landed on `main` via #3494 (merged 2026-10-11).
oneandonlydean commented 2026-10-12 06:16:58 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T06:16:58Z.


Closing: fixed by #3494. The three exports are on main (Pthread/Posix/Attr.cpp). Reopen if a title still reports one of them as unresolved on current main.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6118855561 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3165#issuecomment-6118855561). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-12T06:16:58Z. --- Closing: fixed by #3494. The three exports are on main (`Pthread/Posix/Attr.cpp`). Reopen if a title still reports one of them as unresolved on current main.
Sign in to join this conversation.
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#3165
No description provided.