From 1d1486408b32a105ccc6894986bbcf15201f46eb Mon Sep 17 00:00:00 2001 From: David Xu Date: Tue, 2 Nov 2010 02:13:13 +0000 Subject: [PATCH] Use sysctl kern.sched.cpusetsize to retrieve size of kernel cpuset. --- lib/libthr/thread/thr_attr.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c index c2969e7cc564..0cac528a150d 100644 --- a/lib/libthr/thread/thr_attr.c +++ b/lib/libthr/thread/thr_attr.c @@ -569,14 +569,11 @@ _get_kern_cpuset_size(void) if (kern_cpuset_size == 0) { size_t len; - int maxcpus; - len = sizeof(maxcpus); - if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0)) - PANIC("failed to get sysctl kern.smp.maxcpus"); - int nbits_long = sizeof(long) * NBBY; - int num_long = (maxcpus + nbits_long - 1) / nbits_long; - kern_cpuset_size = num_long * sizeof(long); + len = sizeof(kern_cpuset_size); + if (sysctlbyname("kern.sched.cpusetsize", &kern_cpuset_size, + &len, NULL, 0)) + PANIC("failed to get sysctl kern.sched.cpusetsize"); } return (kern_cpuset_size);