OSDN Git Service

* sysconf.cc (sysconf): Return processors online rather than bitmask for
authorcgf <cgf>
Wed, 9 Jul 2003 23:59:47 +0000 (23:59 +0000)
committercgf <cgf>
Wed, 9 Jul 2003 23:59:47 +0000 (23:59 +0000)
_SC_NPROCESSORS_ONLN.

winsup/cygwin/ChangeLog
winsup/cygwin/sysconf.cc

index e860b36..47ee10b 100644 (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.
index 944afdd..760208a 100644 (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: