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 <errno.h> | 7 #include <errno.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <sys/param.h> | 9 #include <sys/param.h> |
10 #include <sys/utsname.h> | 10 #include <sys/utsname.h> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 struct utsname info; | 68 struct utsname info; |
69 if (uname(&info) < 0) { | 69 if (uname(&info) < 0) { |
70 NOTREACHED(); | 70 NOTREACHED(); |
71 return ""; | 71 return ""; |
72 } | 72 } |
73 return std::string(info.release); | 73 return std::string(info.release); |
74 } | 74 } |
75 #endif | 75 #endif |
76 | 76 |
77 // static | 77 // static |
78 std::string SysInfo::CPUArchitecture() { | 78 std::string SysInfo::OperatingSystemArchitecture() { |
79 struct utsname info; | 79 struct utsname info; |
80 if (uname(&info) < 0) { | 80 if (uname(&info) < 0) { |
81 NOTREACHED(); | 81 NOTREACHED(); |
82 return ""; | 82 return ""; |
83 } | 83 } |
84 std::string arch(info.machine); | 84 std::string arch(info.machine); |
85 if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") { | 85 if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") { |
86 arch = "x86"; | 86 arch = "x86"; |
87 } else if (arch == "amd64") { | 87 } else if (arch == "amd64") { |
88 arch = "x86_64"; | 88 arch = "x86_64"; |
89 } | 89 } |
90 return arch; | 90 return arch; |
91 } | 91 } |
92 | 92 |
93 // static | 93 // static |
94 size_t SysInfo::VMAllocationGranularity() { | 94 size_t SysInfo::VMAllocationGranularity() { |
95 return getpagesize(); | 95 return getpagesize(); |
96 } | 96 } |
97 | 97 |
98 } // namespace base | 98 } // namespace base |
OLD | NEW |