[vlc-devel] [PATCH] Add support for detecting the number of CPUs with OpenBSD.
Brad
brad at comstyle.com
Mon Aug 9 00:39:34 CEST 2010
Add support for detecting the number of CPUs with OpenBSD.
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
-------------- next part --------------
>From 00bb5eed5fe472c9aef743ae98e4a0fb728c2ca3 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Sun, 8 Aug 2010 17:29:59 -0400
Subject: [PATCH] Add support for detecting the number of CPUs with OpenBSD.
---
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;
--
1.7.1
More information about the vlc-devel
mailing list