[vlc-commits] commit: Add support for detecting the number of CPUs with OpenBSD. ( Brad Smith )

git at videolan.org git at videolan.org
Mon Aug 9 08:19:20 CEST 2010


vlc | branch: master | Brad Smith <brad at comstyle.com> | Sun Aug  8 17:29:59 2010 -0400| [568b86621b920efed1c722fcd5dcd74f26c6bf1c] | committer: Jean-Baptiste Kempf 

Add support for detecting the number of CPUs with OpenBSD.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=568b86621b920efed1c722fcd5dcd74f26c6bf1c
---

 src/misc/cpu.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/misc/cpu.c b/src/misc/cpu.c
index 7a3db47..e630e9b 100644
--- a/src/misc/cpu.c
+++ b/src/misc/cpu.c
@@ -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;



More information about the vlc-commits mailing list