HomeFreeBSD

sched_get/setaffinity(): try to be more compatible with Linux

Description

sched_get/setaffinity(): try to be more compatible with Linux

in handling the cpuset sizes different from sizeof(cpuset_t).

For both cases, cpuset size shorter than sizeof(cpuset_t) results
in EINVAL on Linux.

For sched_getaffinity(), be more permissive and accept cpuset size
larger than our cpuset_t, by clipping the syscall argument and zeroing
the rest of the output buffer. For sched_setaffinity(), we should allow
shorter cpusets than current ABI size, again zeroing the rest of the bits.

With this change, python os.sched_get/setaffinity functions work.

Reported by: se
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Details

Provenance
kibAuthored on Jan 2 2022, 10:11 PM
Parents
rG902665210189: libmagic: Remove support for older FreeBSD where xlocale was not available.
Branches
Unknown
Tags
Unknown