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

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: 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..d4508e80d18aaa8165a3b156fcf7ba1fc81606fc 100644
--- a/base/sys_info_openbsd.cc
+++ b/base/sys_info_openbsd.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/logging.h"
Mark Mentovai 2011/10/24 13:43:15 This should come below the system #includes. The #
Robert Nagy 2011/10/24 16:26:56 Done.
#include "base/sys_info.h"
#include <sys/param.h>
#include <sys/sysctl.h>
-
-#include "base/logging.h"
+#include <sys/shm.h>
Mark Mentovai 2011/10/24 13:43:15 Sort. shm < sysctl.
Robert Nagy 2011/10/24 16:26:56 Done.
namespace base {
@@ -15,7 +15,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 +33,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;
Mark Mentovai 2011/10/24 13:43:15 NOTREACHED() to throw up a flare in debug mode? (S
Robert Nagy 2011/10/24 16:26:56 None of the other platform code do this. Any reaso
Mark Mentovai 2011/10/24 17:06:11 Robert Nagy wrote:
+
+ return limit;
+}
+
} // namespace base
« base/file_util_posix.cc ('K') | « base/file_util_posix.cc ('k') | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698