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/file_util.h" |
6 #include "base/sys_info.h" | 6 #include "base/sys_info.h" |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 | 8 |
9 #include <errno.h> | 9 #include <errno.h> |
10 #include <string.h> | 10 #include <string.h> |
11 #include <sys/statvfs.h> | 11 #include <sys/statvfs.h> |
12 #include <sys/utsname.h> | 12 #include <sys/utsname.h> |
13 #include <unistd.h> | 13 #include <unistd.h> |
14 | 14 |
15 #if defined(OS_MACOSX) | 15 #if defined(OS_MACOSX) |
16 #include <mach/mach_host.h> | 16 #include <mach/mach_host.h> |
17 #include <mach/mach_init.h> | 17 #include <mach/mach_init.h> |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(OS_OPENBSD) | 20 #if defined(OS_OPENBSD) || defined(OS_FREEBSD) |
21 #include <sys/param.h> | 21 #include <sys/param.h> |
22 #include <sys/sysctl.h> | 22 #include <sys/sysctl.h> |
23 #endif | 23 #endif |
24 | 24 |
25 #include "base/logging.h" | 25 #include "base/logging.h" |
26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 | 29 |
30 int SysInfo::NumberOfProcessors() { | 30 int SysInfo::NumberOfProcessors() { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 if (!limit_valid) { | 165 if (!limit_valid) { |
166 std::string contents; | 166 std::string contents; |
167 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); | 167 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); |
168 limit = strtoul(contents.c_str(), NULL, 0); | 168 limit = strtoul(contents.c_str(), NULL, 0); |
169 limit_valid = true; | 169 limit_valid = true; |
170 } | 170 } |
171 | 171 |
172 return limit; | 172 return limit; |
173 } | 173 } |
| 174 #elif defined(OS_FREEBSD) |
| 175 size_t SysInfo::MaxSharedMemorySize() { |
| 176 // TODO(benl): we should be able to get this from sysctl |
| 177 // (kern.ipc.shmmax) but the constants are missing from the headers... |
| 178 return 33554432; |
| 179 } |
174 #endif | 180 #endif |
175 | 181 |
176 } // namespace base | 182 } // namespace base |
OLD | NEW |