libkernel/libSceLibcInternal: pthread_setaffinity_np, sys_siglist and sys_nsig are absent (PS5CEMU-HAR after #3787); branch ready #4463

Closed
opened 2026-10-12 12:28:37 +00:00 by screamm · 2 comments
screamm commented 2026-10-12 12:28:37 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-12T12:28:37Z.


libkernel lacks pthread_setaffinity_np (NID 5KWrg7-ZqvE) and libSceLibcInternal the data exports sys_siglist (yCdGspbNHZ8) and sys_nsig (ZD+Dp+-LsGg). PS5CEMU-HAR (PPSA99360) stops on the first once #3787 is in: babyhuey's run on #3787 (2026-10-12 10:54Z) gives FAIL: unresolved ELF import 5KWrg7-ZqvE (pthread_setaffinity_np) from libkernel.prx on Windows and undefined symbol: 5KWrg7-ZqvE (pthread_setaffinity_np) on Linux; the two data symbols follow in its registry (predicted FAIL: unresolved ELF import ZD+Dp+-LsGg from libSceLibcInternal.prx).

Branch ready: screamm:feat/libkernel-setaffinity-siglist (two commits on main ffa19840, head 827a8c87: feat(libkernel): implement pthread_setaffinity_np, feat(libSceLibcInternal): export sys_siglist and sys_nsig). I cannot open it as a PR under the intake rule while #4081 is open; anyone eligible is welcome to carry it, keeping the commits as they are. #4086 also edits Pthread/Posix/Thread.cpp, so a textual conflict is possible.

  • pthread_setaffinity_np(thread, size, set) follows FreeBSD 11.4 libthr thr_affinity.c:41-62 over kern_cpuset.c (8c639945): for another thread the lookup comes first (null EINVAL, unknown or finished thread ESRCH, via a new IsLiveGuestThread helper), then a size other than the 32-byte guest cpuset_t ERANGE (as the kernel and the existing pthread_getaffinity_np do), null set EFAULT, the mask clipped to sceKernelGetAvailableCpumask() with an empty result EDEADLK. The affinity is stored on the guest thread object for any thread and not applied to the host thread, the same model as scePthreadSetaffinity; recorded in TechnicalDebt (the EDEADLK outcome is unverified on console; the live-thread check and the store are not under one lock, like the other scePthread* calls).
  • sys_siglist (the 32 FreeBSD descriptions from lib/libc/gen/siglist.c:73-107) and sys_nsig (32, NSIG in sys/signal.h) as plain _nid_postfix data exports in a new SignalList.cpp, from libSceLibcInternal where the title imports them. tools/progress.py does not count data exports.
  • guest_available_cpumask gains the round trips through pthread_getaffinity_np for the caller and another thread, dropped unavailable bits, EDEADLK, ERANGE for sizes 0/8/31/33/64, EFAULT, EINVAL, ESRCH for a made-up pointer and a joined thread; new guest_signal_list reads sys_nsig and sys_siglist[SIGINT] and others through the exports.

Tested on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, BUILD_TESTING=ON, full build including libs: both tests 3/3; ctest -j8 -E "^agc_driver_|^video_out_flip" 607/607; with main's Pthread/Posix/Thread.cpp the extended cpumask test fails; tools/check_conventions.py --base main and git diff --check pass. Not run on Linux; the title needs #3787 first.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5813726191 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4463). Originally posted by [screamm](https://github.com/screamm) on 2026-10-12T12:28:37Z. --- libkernel lacks `pthread_setaffinity_np` (NID `5KWrg7-ZqvE`) and libSceLibcInternal the data exports `sys_siglist` (`yCdGspbNHZ8`) and `sys_nsig` (`ZD+Dp+-LsGg`). PS5CEMU-HAR (PPSA99360) stops on the first once #3787 is in: babyhuey's run on #3787 (2026-10-12 10:54Z) gives `FAIL: unresolved ELF import 5KWrg7-ZqvE (pthread_setaffinity_np) from libkernel.prx` on Windows and `undefined symbol: 5KWrg7-ZqvE (pthread_setaffinity_np)` on Linux; the two data symbols follow in its registry (predicted `FAIL: unresolved ELF import ZD+Dp+-LsGg from libSceLibcInternal.prx`). **Branch ready:** [`screamm:feat/libkernel-setaffinity-siglist`](https://github.com/screamm/AnyPS5/tree/feat/libkernel-setaffinity-siglist) (two commits on `main` `ffa19840`, head `827a8c87`: `feat(libkernel): implement pthread_setaffinity_np`, `feat(libSceLibcInternal): export sys_siglist and sys_nsig`). I cannot open it as a PR under the intake rule while #4081 is open; anyone eligible is welcome to carry it, keeping the commits as they are. #4086 also edits `Pthread/Posix/Thread.cpp`, so a textual conflict is possible. - `pthread_setaffinity_np(thread, size, set)` follows FreeBSD 11.4 libthr `thr_affinity.c:41-62` over `kern_cpuset.c` (`8c639945`): for another thread the lookup comes first (null `EINVAL`, unknown or finished thread `ESRCH`, via a new `IsLiveGuestThread` helper), then a size other than the 32-byte guest `cpuset_t` `ERANGE` (as the kernel and the existing `pthread_getaffinity_np` do), null set `EFAULT`, the mask clipped to `sceKernelGetAvailableCpumask()` with an empty result `EDEADLK`. The affinity is stored on the guest thread object for any thread and not applied to the host thread, the same model as `scePthreadSetaffinity`; recorded in TechnicalDebt (the `EDEADLK` outcome is unverified on console; the live-thread check and the store are not under one lock, like the other `scePthread*` calls). - `sys_siglist` (the 32 FreeBSD descriptions from `lib/libc/gen/siglist.c:73-107`) and `sys_nsig` (32, `NSIG` in `sys/signal.h`) as plain `_nid_postfix` data exports in a new `SignalList.cpp`, from libSceLibcInternal where the title imports them. `tools/progress.py` does not count data exports. - `guest_available_cpumask` gains the round trips through `pthread_getaffinity_np` for the caller and another thread, dropped unavailable bits, `EDEADLK`, `ERANGE` for sizes 0/8/31/33/64, `EFAULT`, `EINVAL`, `ESRCH` for a made-up pointer and a joined thread; new `guest_signal_list` reads `sys_nsig` and `sys_siglist[SIGINT]` and others through the exports. **Tested** on Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, `BUILD_TESTING=ON`, full build including `libs`: both tests 3/3; `ctest -j8 -E "^agc_driver_|^video_out_flip"` 607/607; with `main`'s `Pthread/Posix/Thread.cpp` the extended cpumask test fails; `tools/check_conventions.py --base main` and `git diff --check` pass. Not run on Linux; the title needs #3787 first. Written with Claude Code assistance (implementation by a subagent, reviewed and validated in this session).
arcwiser commented 2026-10-12 12:46:48 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by arcwiser on 2026-10-12T12:46:48Z.


I split the offered branch by topic and carried the sys_siglist/sys_nsig commit in #4469 with screamm's authorship preserved. On Windows 11 build 26200 with the supported WinLibs GCC 15.2.0 r7 toolchain, guest_signal_list passes 3/3; conventions and diff checks pass; all 706 built test executables remain registered; and the overlap checker reports no open overlap. The pthread_setaffinity_np commit remains separate and is not part of #4469.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6124549720 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4463#issuecomment-6124549720). Originally posted by [arcwiser](https://github.com/arcwiser) on 2026-10-12T12:46:48Z. --- I split the offered branch by topic and carried the sys_siglist/sys_nsig commit in #4469 with screamm's authorship preserved. On Windows 11 build 26200 with the supported WinLibs GCC 15.2.0 r7 toolchain, guest_signal_list passes 3/3; conventions and diff checks pass; all 706 built test executables remain registered; and the overlap checker reports no open overlap. The pthread_setaffinity_np commit remains separate and is not part of #4469.
oneandonlydean commented 2026-10-14 02:41:03 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:41:03Z.


Closing: fixed on main by #4514 (pthread_setaffinity_np) and #4469 (sys_siglist, sys_nsig). If it still happens on current main, comment here with the title ID and the log line.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6159681611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/4463#issuecomment-6159681611). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T02:41:03Z. --- Closing: fixed on main by #4514 (pthread_setaffinity_np) and #4469 (sys_siglist, sys_nsig). If it still happens on current main, comment here with the title ID and the log line.
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#4463
No description provided.