* sysconf.cc (sysconf): Return processors online rather than bitmask for

_SC_NPROCESSORS_ONLN.
This commit is contained in:
Christopher Faylor 2003-07-09 23:59:47 +00:00
parent 03d65dd99b
commit ab3dc80d9e
2 changed files with 13 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2003-07-09 Christopher Faylor <cgf@redhat.com>
* sysconf.cc (sysconf): Return processors online rather than bitmask
for _SC_NPROCESSORS_ONLN.
2003-07-08 Christopher Faylor <cgf@redhat.com>
* cygheap.cc (creturn): Set appropriate errno when out of memory.

View file

@ -90,7 +90,14 @@ sysconf (int in)
case _SC_NPROCESSORS_CONF:
return sbi.NumberProcessors;
case _SC_NPROCESSORS_ONLN:
return sbi.ActiveProcessors;
{
int i = 0;
do
if (sbi.ActiveProcessors & 1)
i++;
while (sbi.ActiveProcessors >>= 1);
return i;
}
case _SC_PHYS_PAGES:
return sbi.NumberOfPhysicalPages;
case _SC_AVPHYS_PAGES: