From: Brad Smith Date: Sun, 8 Aug 2010 21:29:59 +0000 (-0400) Subject: Add support for detecting the number of CPUs with OpenBSD. X-Git-Tag: 1.2.0-pre1~5531 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=568b86621b920efed1c722fcd5dcd74f26c6bf1c;p=vlc Add support for detecting the number of CPUs with OpenBSD. Signed-off-by: Jean-Baptiste Kempf --- diff --git a/src/misc/cpu.c b/src/misc/cpu.c index 7a3db47342..e630e9b602 100644 --- a/src/misc/cpu.c +++ b/src/misc/cpu.c @@ -49,7 +49,7 @@ #include #endif -#if defined(__OpenBSD__) && defined(__powerpc__) +#if defined(__OpenBSD__) #include #include #include @@ -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;