Date: Tue, 2 Nov 2010 02:13:13 +0000 (UTC) From: David Xu <davidxu@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214653 - head/lib/libthr/thread Message-ID: <201011020213.oA22DDuS007930@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: davidxu Date: Tue Nov 2 02:13:13 2010 New Revision: 214653 URL: http://svn.freebsd.org/changeset/base/214653 Log: Use sysctl kern.sched.cpusetsize to retrieve size of kernel cpuset. Modified: head/lib/libthr/thread/thr_attr.c Modified: head/lib/libthr/thread/thr_attr.c ============================================================================== --- head/lib/libthr/thread/thr_attr.c Tue Nov 2 01:26:21 2010 (r214652) +++ head/lib/libthr/thread/thr_attr.c Tue Nov 2 02:13:13 2010 (r214653) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011020213.oA22DDuS007930>