fix(libkernel): follow the console's set sizes in pthread_getaffinity_np #14039
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14039"
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 EagleBearerYS on 2026-10-31T16:51:28Z.
What
pthread_getaffinity_npfollows the set sizes measured on a PS5:ERANGE;Before, only 8 and 16 were answered, 32 and more returned
ERANGE, and every other size threw.Source: @rooklz's measurement of the console's libthr on a PS5 (comment on #9156).
ERANGE.Still throws: 17 to 23 bytes, which weren't measured.
docs/dev/debt/libkernel.mdrecords that, along with:pthread_setaffinity_np's unmeasured 32-byte limit;cpuset_getaffinityandcpuset_setaffinity, which still accept up to 32 bytes.Overlap:
main, changes how this function copies the set out (EFAULTfor invalid memory). This PR changes only which sizes it accepts. The code merged cleanly, and the debt entry is merged as below.cpuset_getaffinityandcpuset_setaffinity, where @rooklz posted the same measurement. This PR leaves those two functions to it.Tested
guest_available_cpumaskchecks that:ERANGE;Linux (Ubuntu 24.04, GCC 13.3, CI flags), 10 runs each:
GitHub's runners (run),
guest_available_cpumask:Thread.cppwith the new test, 3 runsNotImplementedthrowNotImplementedthrowOn @bunbeans2-arch's machine (comment): Windows 11 Pro 10.0.22631, i9-9900K, MSYS2 UCRT64 GCC 16.1.0, Release, this PR's
6093634622merged intomain422367d61a:guest_available_cpumaskpassed 5 of 5;Thread.cppput back tomain's: aborted in 5 of 5 withpthread_getaffinity_np with a set other than 8, 16 or 32 bytes and more not implemented;mainalone, with its own test: 3 of 3.711f3a69f1, a merge ofmain26fa1212b8, and8cd23f7997(run):EFAULTfallback to thepthread_getaffinity_npdebt entry that this PR rewrites, and that entry was the one conflict. The merge keeps this PR's entry, then #13908's sentence word for word.Thread.cppandGuestAvailableCpumask.cppmerged cleanly, and this PR's diff is unchanged.8cd23f7997shortens this PR's wording in that entry, from 1,120 to 961 characters, so it stays under the debt-length limit. Every behaviour it states is kept, and #13908's sentence is unchanged.guest_available_cpumask, with #13908's test changes. Linux: 1 run, 1 pass, 0 skip, 0 fail. Windows: 1 run, 1 pass, 0 skip, 0 fail. The libc and libkernel suites run 207 and 308 tests on Linux and 234 and 330 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.Checks:
tools/check_conventions.py: all passed.tools/check_test_registration.py build: none new.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)