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/param.h> | 9 #include <sys/param.h> |
8 #include <sys/shm.h> | 10 #include <sys/shm.h> |
9 #include <sys/sysctl.h> | 11 #include <sys/sysctl.h> |
10 | 12 |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
12 | 15 |
13 namespace { | 16 namespace { |
14 | 17 |
15 int64_t AmountOfMemory(int pages_name) { | 18 int64_t AmountOfMemory(int pages_name) { |
16 long pages = sysconf(pages_name); | 19 long pages = sysconf(pages_name); |
17 long page_size = sysconf(_SC_PAGESIZE); | 20 long page_size = sysconf(_SC_PAGESIZE); |
18 if (pages == -1 || page_size == -1) { | 21 if (pages == -1 || page_size == -1) { |
19 NOTREACHED(); | 22 NOTREACHED(); |
20 return 0; | 23 return 0; |
21 } | 24 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 char name[256]; | 69 char name[256]; |
67 size_t len = arraysize(name); | 70 size_t len = arraysize(name); |
68 if (sysctl(mib, arraysize(mib), name, &len, NULL, 0) < 0) { | 71 if (sysctl(mib, arraysize(mib), name, &len, NULL, 0) < 0) { |
69 NOTREACHED(); | 72 NOTREACHED(); |
70 return std::string(); | 73 return std::string(); |
71 } | 74 } |
72 return name; | 75 return name; |
73 } | 76 } |
74 | 77 |
75 } // namespace base | 78 } // namespace base |
OLD | NEW |