Commit 568b8662 authored by Brad Smith's avatar Brad Smith Committed by Jean-Baptiste Kempf

Add support for detecting the number of CPUs with OpenBSD.

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent fd294394
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment