diff options
author | davidxu <davidxu@FreeBSD.org> | 2010-10-27 09:29:03 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2010-10-27 09:29:03 +0000 |
commit | f8f25f57e2a01fbe6cab451733e71580e5353a4e (patch) | |
tree | b5f37ad605d5d909d884036425adb213a9833bb7 /lib | |
parent | 73924f958881faa65dcbe928ea800fb849035b3a (diff) | |
download | FreeBSD-src-f8f25f57e2a01fbe6cab451733e71580e5353a4e.zip FreeBSD-src-f8f25f57e2a01fbe6cab451733e71580e5353a4e.tar.gz |
- Revert r214409.
- Use long word to figure out sizeof kernel cpuset, hope it works.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libthr/thread/thr_attr.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/libthr/thread/thr_attr.c b/lib/libthr/thread/thr_attr.c index 7fe50034..bc8eabb 100644 --- a/lib/libthr/thread/thr_attr.c +++ b/lib/libthr/thread/thr_attr.c @@ -574,13 +574,14 @@ _get_kern_cpuset_size(void) if (kern_cpuset_size == 0) { size_t len; + int maxcpus; - len = sizeof(kern_cpuset_size); - if (sysctlbyname("kern.smp.maxcpus", &kern_cpuset_size, - &len, NULL, 0)) + len = sizeof(maxcpus); + if (sysctlbyname("kern.smp.maxcpus", &maxcpus, &len, NULL, 0)) PANIC("failed to get sysctl kern.smp.maxcpus"); - - kern_cpuset_size = (kern_cpuset_size + 7) / 8; + int nbits_long = sizeof(long) * NBBY; + int num_long = (maxcpus + nbits_long - 1) / nbits_long; + kern_cpuset_size = num_long * sizeof(long); } return (kern_cpuset_size); |