diff --git a/lib/libc/gen/sched_getaffinity.c b/lib/libc/gen/sched_getaffinity.c --- a/lib/libc/gen/sched_getaffinity.c +++ b/lib/libc/gen/sched_getaffinity.c @@ -38,9 +38,11 @@ sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset) { cpuwhich_t which; - int error; + int error, osrel; - if (__getosreldate() < P_OSREL_TIDPID) { + osrel = __getosreldate(); + if (osrel < P_OSREL_TIDPID_13 || (osrel < P_OSREL_TIDPID && + P_OSREL_MAJOR(osrel) == P_OSREL_MAJOR(P_OSREL_TIDPID))) { if (pid == 0 || pid > _PID_MAX) which = CPU_WHICH_TID; else diff --git a/lib/libc/gen/sched_setaffinity.c b/lib/libc/gen/sched_setaffinity.c --- a/lib/libc/gen/sched_setaffinity.c +++ b/lib/libc/gen/sched_setaffinity.c @@ -41,10 +41,12 @@ static int mp_maxid; cpuwhich_t which; cpuset_t c; - int error, lbs, cpu; + int error, lbs, cpu, osrel; size_t len, sz; - if (__getosreldate() < P_OSREL_TIDPID) { + osrel = __getosreldate(); + if (osrel < P_OSREL_TIDPID_13 || (osrel < P_OSREL_TIDPID && + P_OSREL_MAJOR(osrel) == P_OSREL_MAJOR(P_OSREL_TIDPID))) { if (pid == 0 || pid > _PID_MAX) which = CPU_WHICH_TID; else diff --git a/sys/sys/param.h b/sys/sys/param.h --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -92,6 +92,7 @@ #define P_OSREL_CK_INODE 1300005 #define P_OSREL_POWERPC_NEW_AUX_ARGS 1300070 #define P_OSREL_TIDPID 1400079 +#define P_OSREL_TIDPID_13 1302501 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif