# HG changeset patch # User frosch # Date 2014-04-27 13:21:30 # Node ID 5562a7bad68210a29e04f4a64131d405a5f92a4e # Parent 7897be36f1962a23301a93614ca99f6a9f4b0938 (svn r26523) -Fix [FS#5992]: OpenBSD compilation (MagisterQuis) diff --git a/src/os/unix/unix.cpp b/src/os/unix/unix.cpp --- a/src/os/unix/unix.cpp +++ b/src/os/unix/unix.cpp @@ -340,9 +340,18 @@ uint GetCPUCoreCount() int ncpu = 0; size_t len = sizeof(ncpu); +#ifdef OPENBSD + int name[2]; + name[0] = CTL_HW; + name[1] = HW_NCPU; + if (sysctl(name, 2, &ncpu, &len, NULL, 0) < 0) { + ncpu = 0; + } +#else if (sysctlbyname("hw.availcpu", &ncpu, &len, NULL, 0) < 0) { sysctlbyname("hw.ncpu", &ncpu, &len, NULL, 0); } +#endif /* #ifdef OPENBSD */ if (ncpu > 0) count = ncpu; #elif defined(_SC_NPROCESSORS_ONLN)