Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1712)

Unified Diff: base/sys_info_openbsd.cc

Issue 8382001: OpenBSD patches for base and build, part 2 (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fixes for previous patchset Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/sys_info_openbsd.cc
diff --git a/base/sys_info_openbsd.cc b/base/sys_info_openbsd.cc
index 2d1b3906a70f23fce81d585313fdbdb9cd9e10e8..0dbe17f8fc1c668574c55ce07df5d5ae8bf2692e 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)
+ return 0;
+
+ return limit;
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698