]> git.sesse.net Git - vlc/commitdiff
Add support for detecting the number of CPUs with OpenBSD.
authorBrad Smith <brad@comstyle.com>
Sun, 8 Aug 2010 21:29:59 +0000 (17:29 -0400)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 9 Aug 2010 06:18:36 +0000 (08:18 +0200)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
src/misc/cpu.c

index 7a3db473420817637e43c5490e681333b83ffd3c..e630e9b60263f6069ea075b8403d491779bfb043 100644 (file)
@@ -49,7 +49,7 @@
 #include <sys/sysctl.h>
 #endif
 
-#if defined(__OpenBSD__) && defined(__powerpc__)
+#if defined(__OpenBSD__)
 #include <sys/param.h>
 #include <sys/sysctl.h>
 #include <machine/cpu.h>
@@ -368,6 +368,13 @@ unsigned vlc_GetCPUCount(void)
     if (sysctlbyname("hw.ncpu", &count, &size, NULL, 0))
         return 1; /* Failure */
     return count;
+#elif defined(__OpenBSD__)
+    int selectors[2] = { CTL_HW, HW_NCPU };
+    int count;
+    size_t size = sizeof(count) ;
+    if (sysctl(selectors, 2, &count, &size, NULL, 0))
+        return 1; /* Failure */
+    return count;
 #elif defined(__SunOS)
     unsigned count = 0;
     int type;