Index: base/sys_info_openbsd.cc |
diff --git a/base/sys_info_openbsd.cc b/base/sys_info_openbsd.cc |
index 2d1b3906a70f23fce81d585313fdbdb9cd9e10e8..b9aec20e74cd9cbf0b60155194f86be84fd039b1 100644 |
--- a/base/sys_info_openbsd.cc |
+++ b/base/sys_info_openbsd.cc |
@@ -5,6 +5,7 @@ |
#include "base/sys_info.h" |
#include <sys/param.h> |
+#include <sys/shm.h> |
#include <sys/sysctl.h> |
#include "base/logging.h" |
@@ -15,7 +16,7 @@ int SysInfo::NumberOfProcessors() { |
int mib[] = { CTL_HW, HW_NCPU }; |
int ncpu; |
size_t size = sizeof(ncpu); |
- if (sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) { |
+ if (sysctl(mib, arraysize(mib), &ncpu, &size, NULL, 0) == -1) { |
NOTREACHED(); |
return 1; |
} |
@@ -33,4 +34,15 @@ int64 SysInfo::AmountOfPhysicalMemory() { |
return static_cast<int64>(pages) * page_size; |
} |
+size_t SysInfo::MaxSharedMemorySize() { |
+ int mib[] = { CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX }; |
+ size_t limit; |
+ size_t size = sizeof(limit); |
+ if (sysctl(mib, arraysize(mib), &limit, &size, NULL, 0) < 0) { |
+ NOTREACHED(); |
+ return 0; |
+ } |
+ return limit; |
+} |
+ |
} // namespace base |