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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 } | 72 } |
73 #endif | 73 #endif |
74 | 74 |
75 // static | 75 // static |
76 std::string SysInfo::CPUArchitecture() { | 76 std::string SysInfo::CPUArchitecture() { |
77 struct utsname info; | 77 struct utsname info; |
78 if (uname(&info) < 0) { | 78 if (uname(&info) < 0) { |
79 NOTREACHED(); | 79 NOTREACHED(); |
80 return ""; | 80 return ""; |
81 } | 81 } |
82 return std::string(info.machine); | 82 std::string arch(info.machine); |
83 if (arch == "i386" || arch == "i486" || arch == "i586" || arch == "i686") { | |
84 arch = "x86"; | |
85 } else if (arch == "amd64") { | |
86 arch = "x86_64"; | |
Mark Mentovai
2012/09/13 12:40:19
For Mac and Linux x86_*, this returns the kernel’s
Lei Zhang
2012/09/21 21:10:21
Right, I think CPUArchitecture() should be renamed
| |
87 } | |
88 return arch; | |
83 } | 89 } |
84 | 90 |
85 // static | 91 // static |
86 size_t SysInfo::VMAllocationGranularity() { | 92 size_t SysInfo::VMAllocationGranularity() { |
87 return getpagesize(); | 93 return getpagesize(); |
88 } | 94 } |
89 | 95 |
90 } // namespace base | 96 } // namespace base |
OLD | NEW |