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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { | 43 int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { |
44 base::ThreadRestrictions::AssertIOAllowed(); | 44 base::ThreadRestrictions::AssertIOAllowed(); |
45 | 45 |
46 struct statvfs stats; | 46 struct statvfs stats; |
47 if (statvfs(path.value().c_str(), &stats) != 0) { | 47 if (statvfs(path.value().c_str(), &stats) != 0) { |
48 return -1; | 48 return -1; |
49 } | 49 } |
50 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; | 50 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; |
51 } | 51 } |
52 | 52 |
53 #if !defined(OS_MACOSX) | 53 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
54 // static | 54 // static |
55 std::string SysInfo::OperatingSystemName() { | 55 std::string SysInfo::OperatingSystemName() { |
56 struct utsname info; | 56 struct utsname info; |
57 if (uname(&info) < 0) { | 57 if (uname(&info) < 0) { |
58 NOTREACHED(); | 58 NOTREACHED(); |
59 return ""; | 59 return ""; |
60 } | 60 } |
61 return std::string(info.sysname); | 61 return std::string(info.sysname); |
62 } | 62 } |
| 63 #endif |
63 | 64 |
| 65 #if !defined(OS_MACOSX) |
64 // static | 66 // static |
65 std::string SysInfo::OperatingSystemVersion() { | 67 std::string SysInfo::OperatingSystemVersion() { |
66 struct utsname info; | 68 struct utsname info; |
67 if (uname(&info) < 0) { | 69 if (uname(&info) < 0) { |
68 NOTREACHED(); | 70 NOTREACHED(); |
69 return ""; | 71 return ""; |
70 } | 72 } |
71 return std::string(info.release); | 73 return std::string(info.release); |
72 } | 74 } |
73 #endif | 75 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
87 } | 89 } |
88 return arch; | 90 return arch; |
89 } | 91 } |
90 | 92 |
91 // static | 93 // static |
92 size_t SysInfo::VMAllocationGranularity() { | 94 size_t SysInfo::VMAllocationGranularity() { |
93 return getpagesize(); | 95 return getpagesize(); |
94 } | 96 } |
95 | 97 |
96 } // namespace base | 98 } // namespace base |
OLD | NEW |