Repository navigation
feat(libkernel): implement pthread_setaffinity_np - #4514
oneandonlydean merged 1 commit into
Conversation
|
I ran the carried commit Tests
Title. PS5CEMU-HAR (PPSA99360, catalog 3.5.0), relinked with
So this PR moves the title past AI-assisted: yes (Claude Code) |
|
Please rebase onto main and drop the merge commit ( |
|
Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Ninja, Release, PS5CEMU-HAR (PPSA99360, relinked with |
Uses the existing GuestThreadIsLive, rejects masks outside sceKernelGetAvailableCpumask (bits 64-255 included) or empty with EDEADLK per FreeBSD cpuset_shadow instead of clipping, stores another thread's affinity under the registry lock; debt entry moved to docs/dev/debt/libkernel.md.
|
Title run with this PR: Windows 11, MinGW GCC 15.2.0 (WinLibs), Release, on
AI-assisted (Claude Code). |
PS5CEMU-HAR (PPSA99360, ps5-payload-dev build, relinks with --trap-sdk-syscall-stubs) imports pthread_setaffinity_np (5KWrg7-ZqvE) from libkernel.prx. babyhuey's run with boykopovar#3787 merged onto main e7c70a2 (PR boykopovar#3787, 2026-10-12T10:54:44Z) stops at it: Windows: FAIL: unresolved ELF import 5KWrg7-ZqvE (pthread_setaffinity_np) from libkernel.prx Linux: undefined symbol: 5KWrg7-ZqvE (pthread_setaffinity_np) It follows FreeBSD 11.4 libthr thr_affinity.c (8c639945) over kern_cpuset_setaffinity: another thread is looked up first (EINVAL for null, ESRCH when unknown or finished, as _thr_find_thread without dead threads), a size other than the 32-byte cpuset_t returns ERANGE, the mask is clipped to sceKernelGetAvailableCpumask and an empty result returns EDEADLK, as cpuset_setaffinity does. The affinity is stored on the guest thread through scePthreadSetaffinity, for the caller and for any live guest thread. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87283af to
74c3fb6
Compare
What
Carries screamm's standalone
pthread_setaffinity_npcommit from #4463 unchanged, preserving the original commit and authorship.The implementation follows the FreeBSD-style affinity behavior described and tested in #4463: validate another thread before the cpuset size, require the 32-byte guest
cpuset_t, reject a null set, clip the requested mask tosceKernelGetAvailableCpumask(), reject an empty result, and store the affinity through the existing guest-thread path. The accompanyingguest_available_cpumaskcoverage exercises the caller, another live thread, unavailable bits, invalid sizes/pointers, unknown threads, and joined threads.This addresses the
pthread_setaffinity_nphalf of #4463. Thesys_siglist/sys_nsighalf is already carried separately in #4469.Tested
Not rerun locally in this carry checkout. The original author reports Windows 11 / WinLibs GCC 15.2.0 Release testing with
guest_available_cpumask3/3, the non-GPU suite 607/607,tools/check_conventions.py --base main, andgit diff --checkpassing; details are in #4463.GitHub's PR workflows passed on the unchanged carried commit before the branch sync. The branch now merge-syncs upstream
mainat8fa5cc486687471840d232e18d58dbdb2a68a660while preserving screamm's original commit018524d5295de79e174494286b620a2d8d7d8d30unchanged in history.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repository