summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2010-11-02 02:13:13 +0000
committerdavidxu <davidxu@FreeBSD.org>2010-11-02 02:13:13 +0000
commit344bdcae8884b9f22864f13b338f13709aa2bb4a (patch)
treecd172df5efc1743334b3a763359ed6c36587c3f1 /lib
parentec0656696958cbb23e5b5a783eaf0a2cc6ec47d0 (diff)
downloadFreeBSD-src-344bdcae8884b9f22864f13b338f13709aa2bb4a.zip
FreeBSD-src-344bdcae8884b9f22864f13b338f13709aa2bb4a.tar.gz
Use sysctl kern.sched.cpusetsize to retrieve size of kernel cpuset.
Diffstat (limited to 'lib')
-rw-r--r--lib/libthr/thread/thr_attr.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c
index c2969e7..0cac528 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);
OpenPOWER on IntegriCloud