OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
| 5 #include "base/file_util.h" |
5 #include "base/sys_info.h" | 6 #include "base/sys_info.h" |
6 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
7 | 8 |
8 #include <errno.h> | 9 #include <errno.h> |
9 #include <string.h> | 10 #include <string.h> |
10 #include <sys/statvfs.h> | 11 #include <sys/statvfs.h> |
11 #include <sys/utsname.h> | 12 #include <sys/utsname.h> |
12 #include <unistd.h> | 13 #include <unistd.h> |
13 | 14 |
14 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 int SysInfo::DisplayCount() { | 144 int SysInfo::DisplayCount() { |
144 NOTIMPLEMENTED(); | 145 NOTIMPLEMENTED(); |
145 return 1; | 146 return 1; |
146 } | 147 } |
147 | 148 |
148 // static | 149 // static |
149 size_t SysInfo::VMAllocationGranularity() { | 150 size_t SysInfo::VMAllocationGranularity() { |
150 return getpagesize(); | 151 return getpagesize(); |
151 } | 152 } |
152 | 153 |
| 154 #if defined(OS_LINUX) |
| 155 // static |
| 156 size_t SysInfo::MaxSharedMemorySize() { |
| 157 static size_t limit; |
| 158 static bool limit_valid = false; |
| 159 |
| 160 if (!limit_valid) { |
| 161 std::string contents; |
| 162 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); |
| 163 limit = strtoul(contents.c_str(), NULL, 0); |
| 164 limit_valid = true; |
| 165 } |
| 166 |
| 167 return limit; |
| 168 } |
| 169 #endif |
| 170 |
153 } // namespace base | 171 } // namespace base |
OLD | NEW |