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 <sys/param.h> | 7 #include <sys/param.h> |
8 #include <sys/shm.h> | 8 #include <sys/shm.h> |
9 #include <sys/sysctl.h> | 9 #include <sys/sysctl.h> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 // static | 41 // static |
42 int64 SysInfo::AmountOfPhysicalMemory() { | 42 int64 SysInfo::AmountOfPhysicalMemory() { |
43 return AmountOfMemory(_SC_PHYS_PAGES); | 43 return AmountOfMemory(_SC_PHYS_PAGES); |
44 } | 44 } |
45 | 45 |
46 // static | 46 // static |
47 int64 SysInfo::AmountOfAvailablePhysicalMemory() { | 47 int64 SysInfo::AmountOfAvailablePhysicalMemory() { |
48 return AmountOfMemory(_SC_AVPHYS_PAGES); | 48 return AmountOfMemory(_SC_AVPHYS_PAGES); |
49 } | 49 } |
50 | 50 |
51 bool SysInfo::HasSeekPenalty(const FilePath& path, bool* has_seek_penalty) { | |
52 return false; | |
53 } | |
54 | |
55 // static | 51 // static |
56 size_t SysInfo::MaxSharedMemorySize() { | 52 uint64 SysInfo::MaxSharedMemorySize() { |
57 int mib[] = { CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX }; | 53 int mib[] = { CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX }; |
58 size_t limit; | 54 size_t limit; |
59 size_t size = sizeof(limit); | 55 size_t size = sizeof(limit); |
60 if (sysctl(mib, arraysize(mib), &limit, &size, NULL, 0) < 0) { | 56 if (sysctl(mib, arraysize(mib), &limit, &size, NULL, 0) < 0) { |
61 NOTREACHED(); | 57 NOTREACHED(); |
62 return 0; | 58 return 0; |
63 } | 59 } |
64 return limit; | 60 return static_cast<uint64>(limit); |
65 } | 61 } |
66 | 62 |
67 // static | 63 // static |
68 std::string SysInfo::CPUModelName() { | 64 std::string SysInfo::CPUModelName() { |
69 int mib[] = { CTL_HW, HW_MODEL }; | 65 int mib[] = { CTL_HW, HW_MODEL }; |
70 char name[256]; | 66 char name[256]; |
71 size_t len = arraysize(name); | 67 size_t len = arraysize(name); |
72 if (sysctl(mib, arraysize(mib), name, &len, NULL, 0) < 0) { | 68 if (sysctl(mib, arraysize(mib), name, &len, NULL, 0) < 0) { |
73 NOTREACHED(); | 69 NOTREACHED(); |
74 return std::string(); | 70 return std::string(); |
75 } | 71 } |
76 return name; | 72 return name; |
77 } | 73 } |
78 | 74 |
79 } // namespace base | 75 } // namespace base |
OLD | NEW |