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

Unified Diff: base/sys_info_posix.cc

Issue 159843: Linux: don't try and read shmmax in the sandbox. (Closed)
Patch Set: Created 11 years, 4 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
« no previous file with comments | « base/sys_info.h ('k') | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_posix.cc
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc
index 388ccba4b9ec7d3edd7356f2f29f5bac5d54de7c..23156e2c2a8a838c8615cc37afea06bf8f3e9c97 100644
--- a/base/sys_info_posix.cc
+++ b/base/sys_info_posix.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/file_util.h"
#include "base/sys_info.h"
#include "base/basictypes.h"
@@ -150,4 +151,21 @@ size_t SysInfo::VMAllocationGranularity() {
return getpagesize();
}
+#if defined(OS_LINUX)
+// static
+size_t SysInfo::MaxSharedMemorySize() {
+ static size_t limit;
+ static bool limit_valid = false;
+
+ if (!limit_valid) {
+ std::string contents;
+ file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents);
+ limit = strtoul(contents.c_str(), NULL, 0);
+ limit_valid = true;
+ }
+
+ return limit;
+}
+#endif
+
} // namespace base
« no previous file with comments | « base/sys_info.h ('k') | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698