| 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 #include "base/basictypes.h" | 6 #include "base/basictypes.h" |
| 7 | 7 |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 #include <sys/statvfs.h> | 10 #include <sys/statvfs.h> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 return static_cast<int64>(pages) * page_size; | 60 return static_cast<int64>(pages) * page_size; |
| 61 #endif | 61 #endif |
| 62 } | 62 } |
| 63 | 63 |
| 64 // static | 64 // static |
| 65 int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) { | 65 int64 SysInfo::AmountOfFreeDiskSpace(const std::wstring& path) { |
| 66 struct statvfs stats; | 66 struct statvfs stats; |
| 67 if (statvfs(WideToUTF8(path).c_str(), &stats) != 0) { | 67 if (statvfs(WideToUTF8(path).c_str(), &stats) != 0) { |
| 68 return 0; | 68 return -1; |
| 69 } | 69 } |
| 70 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; | 70 return static_cast<int64>(stats.f_bavail) * stats.f_frsize; |
| 71 } | 71 } |
| 72 | 72 |
| 73 } // namespace base | 73 } // namespace base |
| OLD | NEW |