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 |