Use Linux semantics for the thread affinity syscalls.
authorDmitry Chagin <dchagin@FreeBSD.org>
Wed, 11 May 2022 07:36:01 +0000 (10:36 +0300)
committerDmitry Chagin <dchagin@FreeBSD.org>
Wed, 11 May 2022 07:36:01 +0000 (10:36 +0300)
commitf35093f8d6d8155ab2e56c11ee03d474688b16a2
tree5ad44d7a5478f8b300f855126c3415b4c4631076
parent50dd2ceaea44d3e5b7aa676c4a6ca3c9dca79a72
Use Linux semantics for the thread affinity syscalls.

Linux has more tolerant checks of the user supplied cpuset_t's.

Minimum cpuset_t size that the Linux kernel permits in case of
getaffinity() is the maximum CPU id, present in the system / NBBY,
the maximum size is not limited.
For setaffinity(), Linux does not limit the size of the user-provided
cpuset_t, internally using only the meaningful part of the set, where
the upper bound is the maximum CPU id, present in the system, no larger
than the size of the kernel cpuset_t.
Unlike FreeBSD, Linux ignores high bits if set in the setaffinity(),
so clear it in the sched_setaffinity() and Linuxulator itself.

Reviewed by: Pau Amma (man pages)
In collaboration with: jhb
Differential revision: https://reviews.freebsd.org/D34849
MFC after: 2 weeks
lib/libc/gen/sched_getaffinity.c
lib/libc/gen/sched_setaffinity.c
lib/libc/sys/cpuset_getaffinity.2
share/man/man3/pthread_attr_affinity_np.3
sys/compat/freebsd32/freebsd32_misc.c
sys/compat/linux/linux_misc.c
sys/kern/kern_cpuset.c
sys/sys/syscallsubr.h