svn commit: r214653 - head/lib/libthr/thread

David Xu davidxu at FreeBSD.org
Tue Nov 2 02:13:13 UTC 2010


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);


More information about the svn-src-head mailing list