2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 4 Oct 2004 02:37:00 +0000 (02:37 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 4 Oct 2004 02:37:00 +0000 (02:37 -0000)
* system.c: check the number of online processors instead of the
existing ones. Sanitize return value if it's an error.

svn path=/trunk/mono/; revision=34650

mono/io-layer/ChangeLog
mono/io-layer/system.c

index 9e459809560af97b480f4b8a4e0dcd5be61e30d3..7f66f6afa8d82edf536d9619ce1862ca0f3df0cc 100644 (file)
@@ -1,3 +1,8 @@
+2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * system.c: check the number of online processors instead of the
+       existing ones. Sanitize return value if it's an error.
+
 2004-10-03 Ben Maurer  <bmaurer@ximian.com>
 
        * system.c: Add support for getting the # of cpus.
index 9fe870bddc77eb6fead93b48f0e9f44fca11dd06..3a336ce2cef01900d3fb83eddf3235c52bac392a 100644 (file)
@@ -20,8 +20,10 @@ void GetSystemInfo(WapiSystemInfo *info)
        info->dwPageSize=getpagesize();
 
        /* Fill in the rest of this junk. Maybe with libgtop */
-#ifdef _SC_NPROCESSORS_CONF
-       info->dwNumberOfProcessors = sysconf (_SC_NPROCESSORS_CONF);
+#ifdef _SC_NPROCESSORS_ONLN
+       info->dwNumberOfProcessors = sysconf (_SC_NPROCESSORS_ONLN);
+       if (info->dwNumberOfProcessors <= 0)
+               info->dwNumberOfProcessors = 1;
 #else
        info->dwNumberOfProcessors = 1;
 #endif