| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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/statvfs.h> | 9 #include <sys/statvfs.h> |
| 10 #include <sys/utsname.h> | 10 #include <sys/utsname.h> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if (pages == -1 || page_size == -1) { | 79 if (pages == -1 || page_size == -1) { |
| 80 NOTREACHED(); | 80 NOTREACHED(); |
| 81 return 0; | 81 return 0; |
| 82 } | 82 } |
| 83 | 83 |
| 84 return static_cast<int64>(pages) * page_size; | 84 return static_cast<int64>(pages) * page_size; |
| 85 #endif | 85 #endif |
| 86 } | 86 } |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) { | 89 int64 SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { |
| 90 struct statvfs stats; | 90 struct statvfs stats; |
| 91 if (statvfs(WideToUTF8(path).c_str(), &stats) != 0) { | 91 if (statvfs(path.value().c_str(), &stats) != 0) { |
| 92 return -1; | 92 return -1; |
| 93 } | 93 } |
| 94 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; | 94 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; |
| 95 } | 95 } |
| 96 | 96 |
| 97 // static | 97 // static |
| 98 bool SysInfo::HasEnvVar(const wchar_t* var) { | 98 bool SysInfo::HasEnvVar(const wchar_t* var) { |
| 99 std::string var_utf8 = WideToUTF8(std::wstring(var)); | 99 std::string var_utf8 = WideToUTF8(std::wstring(var)); |
| 100 return getenv(var_utf8.c_str()) != NULL; | 100 return getenv(var_utf8.c_str()) != NULL; |
| 101 } | 101 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); | 216 file_util::ReadFileToString(FilePath("/proc/sys/kernel/shmmax"), &contents); |
| 217 limit = strtoul(contents.c_str(), NULL, 0); | 217 limit = strtoul(contents.c_str(), NULL, 0); |
| 218 limit_valid = true; | 218 limit_valid = true; |
| 219 } | 219 } |
| 220 | 220 |
| 221 return limit; | 221 return limit; |
| 222 } | 222 } |
| 223 #endif | 223 #endif |
| 224 | 224 |
| 225 } // namespace base | 225 } // namespace base |
| OLD | NEW |