feat(libkernel): implement cpuset_getaffinity for the calling thread #2859
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2859"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by babyhuey on 2026-10-10T16:48:25Z.
What
Implements
cpuset_getaffinity(Pdgml4rbxYk) in libkernel for the calling thread: levelCPU_LEVEL_WHICH(3), whichCPU_WHICH_TID(1), id -1. It returns the thread's affinity fromscePthreadGetaffinityin the first 8 bytes of the set and zeroes the rest. A set size under 8 or over 32 bytes (256 CPUs) givesERANGEand a null setEFAULT, as FreeBSD 11kern_cpuset_getaffinitychecks them. Any other level, which or id throwsNotImplemented_nid_no_patch.OpenNOW PS5 (PPSA99082) calls it as
cpuset_getaffinity(3, 1, -1, 8, set)and stops at it onmain57f96fd2(catalog build,eboot.binandsce_module/libc.prxunwrapped as #2605 requires; tracked in #1578):main, Linux:app.elf: symbol lookup error: app.elf: undefined symbol: Pdgml4rbxYkapp.elf: symbol lookup error: app.elf: undefined symbol: xFebsA4YsFI(pthread_rwlockattr_init)FAIL: unresolved ELF import xFebsA4YsFI (pthread_rwlockattr_init) from libkernel.prxpthread_rwlockattr_initis the next PR (babyhuey:feat/libkernel-rwlockattr), once this is in.Tested
Linux (Ubuntu 24.04, GCC 13, Release) on
57f96fd2:guest_available_cpumaskpasses 5/5 (--repeat until-fail:5). The new case reads the set from a created thread with 8 bytes (equal tosceKernelGetAvailableCpumask, bytes past the size untouched) and 32 bytes (same mask, rest zeroed) and checksERANGEfor 4 and 33 bytes andEFAULTfor a null set. Windows 11 (MinGW-w64 GCC 15.2 from WinLibs, Release):guest_available_cpumask5/5 and the OpenNOW line above, on the same commit rebased onto197ffac9(the rebase onto57f96fd2had no conflicts and changes nothing in these files).check_conventions.pypasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-10T16:48:54Z.
Progress report (
57f96fd→d2c160b)📉 System libraries: 84.49% (-0.03%, +1 declared functions)
🆕 1 declared as stubs
cpuset_getaffinity_nid_postfix