$OpenBSD$ --- source/vdrift/numprocessors.h.orig Mon Jul 15 02:49:53 2013 +++ source/vdrift/numprocessors.h Mon Jul 15 02:55:54 2013 @@ -8,7 +8,7 @@ namespace NUMPROCESSORS || defined (_WIN64) || defined(__CYGWIN__) || defined(__MINGW32__) #include #include -#elif defined(__APPLE__) || defined (__FreeBSD__) +#elif defined(__APPLE__) || defined (__FreeBSD__) || defined(__OpenBSD__) //#include // Required to get number of processors on OS X using sysctlbyname. @@ -43,6 +43,17 @@ namespace NUMPROCESSORS { return (unsigned int)numProcessors; } +#elif defined(__OpenBSD__) + int ncpu; + size_t size = sizeof(ncpu); + int mib[2]; + + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + if (sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) + return 1; + else + return ncpu; #else // Methods for getting the number of processors: