OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sys_info.h" | 5 #include "base/sys_info.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
7 #include <sys/sysctl.h> | 9 #include <sys/sysctl.h> |
8 | 10 |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
10 | 12 |
11 namespace base { | 13 namespace base { |
12 | 14 |
13 int64_t SysInfo::AmountOfPhysicalMemory() { | 15 int64_t SysInfo::AmountOfPhysicalMemory() { |
14 int pages, page_size; | 16 int pages, page_size; |
15 size_t size = sizeof(pages); | 17 size_t size = sizeof(pages); |
16 sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); | 18 sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0); |
(...skipping 10 matching lines...) Expand all Loading... |
27 size_t limit; | 29 size_t limit; |
28 size_t size = sizeof(limit); | 30 size_t size = sizeof(limit); |
29 if (sysctlbyname("kern.ipc.shmmax", &limit, &size, NULL, 0) < 0) { | 31 if (sysctlbyname("kern.ipc.shmmax", &limit, &size, NULL, 0) < 0) { |
30 NOTREACHED(); | 32 NOTREACHED(); |
31 return 0; | 33 return 0; |
32 } | 34 } |
33 return static_cast<uint64_t>(limit); | 35 return static_cast<uint64_t>(limit); |
34 } | 36 } |
35 | 37 |
36 } // namespace base | 38 } // namespace base |
OLD | NEW |