diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c --- a/lib/libthr/thread/thr_attr.c +++ b/lib/libthr/thread/thr_attr.c @@ -597,11 +597,12 @@ if (kern_cpuset_size == 0) { size_t len; + int maxid; - len = sizeof(kern_cpuset_size); - if (sysctlbyname("kern.sched.cpusetsize", &kern_cpuset_size, - &len, NULL, 0)) - PANIC("failed to get sysctl kern.sched.cpusetsize"); + len = sizeof(maxid); + if (sysctlbyname("kern.smp.maxid", &maxid, &len, NULL, 0)) + PANIC("failed to get sysctl kern.smp.maxid"); + kern_cpuset_size = howmany(maxid, NBBY); } return (kern_cpuset_size); diff --git a/share/man/man3/pthread_attr_affinity_np.3 b/share/man/man3/pthread_attr_affinity_np.3 --- a/share/man/man3/pthread_attr_affinity_np.3 +++ b/share/man/man3/pthread_attr_affinity_np.3 @@ -52,16 +52,16 @@ .Dv CPU_SET macros. If the user-supplied mask is not large enough to fit all of the matching CPUs, -.Fn cpuset_getaffinity +.Fn pthread_attr_getaffinity_np fails with .Er ERANGE . Calls to -.Fn cpuset_setaffinity +.Fn pthread_attr_setaffinity_np tolerate masks of any size with no restrictions. The kernel uses the meaningful part of the mask, where the upper bound is the maximum CPU id present in the system. If bits for non-existing CPUs are set, calls to -.Fn cpuset_setaffinity +.Fn pthread_attr_setaffinity_np fails with .Er EINVAL . .Pp