* Handle threads without masks: this means they can run on any CPU.
* Return only enabled CPUs from get_thread_affinity.
* Clear the user mask's extra bits.
* Allow masks with more CPUs set than are active, same as Linux,
but disallow masks with no intersection with the active CPUs.
* If setting to all enabled CPUs, clear the mask, so that if
more CPUs are enabled in the future, this can run on them too.
* Add permissions checks.
Fixes#20251.
(cherry picked from commit f46b3483057b149179dda7abdcc2dde38994a8cc)
Change-Id: Ib8649cb0a252fc8d9cfca691c2e03748561db741
Reviewed-on: https://review.haiku-os.org/c/haiku/+/11529
Reviewed-by: waddlesplash <[email protected]>