svn commit: r237660 - head/lib/libc/gen

Attilio Rao attilio at freebsd.org
Thu Jun 28 02:21:47 UTC 2012


2012/6/28, David Xu <listlog2011 at gmail.com>:
> On 2012/6/28 4:32, Konstantin Belousov wrote:
>> Author: kib
>> Date: Wed Jun 27 20:32:45 2012
>> New Revision: 237660
>> URL: http://svn.freebsd.org/changeset/base/237660
>>
>> Log:
>>    Optimize the handling of SC_NPROCESSORS_CONF, by using auxv AT_NCPU
>>    value if present.
>>
>>    MFC after:	1 week
>>
>> Modified:
>>    head/lib/libc/gen/sysconf.c
>>
>> Modified: head/lib/libc/gen/sysconf.c
>> ==============================================================================
>> --- head/lib/libc/gen/sysconf.c	Wed Jun 27 20:24:25 2012	(r237659)
>> +++ head/lib/libc/gen/sysconf.c	Wed Jun 27 20:32:45 2012	(r237660)
>> @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
>>   #include<sys/resource.h>
>>   #include<sys/socket.h>
>>
>> +#include<elf.h>
>>   #include<errno.h>
>>   #include<limits.h>
>>   #include<paths.h>
>> @@ -51,6 +52,7 @@ __FBSDID("$FreeBSD$");
>>
>>   #include "../stdlib/atexit.h"
>>   #include "tzfile.h"		/* from ../../../contrib/tzcode/stdtime */
>> +#include "libc_private.h"
>>
>>   #define	_PATH_ZONEINFO	TZDIR	/* from tzfile.h */
>>
>> @@ -585,6 +587,8 @@ yesno:
>>
>>   	case _SC_NPROCESSORS_CONF:
>>   	case _SC_NPROCESSORS_ONLN:
>> +		if (_elf_aux_info(AT_NCPUS,&value, sizeof(value)) == 0)
>> +			return ((long)value);
>>   		mib[0] = CTL_HW;
>>   		mib[1] = HW_NCPU;
>>   		break;
>>
> Will this make controlling the number of CPU online or CPU hotplug
> be impossible on FreeBSD ?

If I think about hotplug CPUs I can think of other 1000
problems/races/bad situations to be fixed before this one, really.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the svn-src-head mailing list