Index: base/sys_info_posix.cc |
diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc |
index 85ae039118986d211ea3964e38f271c4beb3a026..4df96587f968d09a24a349d902101850e8bd115e 100644 |
--- a/base/sys_info_posix.cc |
+++ b/base/sys_info_posix.cc |
@@ -98,6 +98,21 @@ int64_t SysInfo::AmountOfFreeDiskSpace(const FilePath& path) { |
return static_cast<int64_t>(stats.f_bavail) * stats.f_frsize; |
Dan Beam
2016/06/09 17:20:13
nit: maybe use GetDiskSpaceInfo() to implement Amo
fukino
2016/06/10 01:33:36
Done.
I updated this to use GetDiskSpaceInfo() in
|
} |
+// static |
+bool SysInfo::GetDiskSpaceInfo(const FilePath& path, |
+ int64_t* available_bytes, |
+ int64_t* total_bytes) { |
+ ThreadRestrictions::AssertIOAllowed(); |
+ |
+ struct statvfs stats; |
+ if (HANDLE_EINTR(statvfs(path.value().c_str(), &stats)) != 0) |
+ return false; |
+ |
+ *available_bytes = static_cast<uint64_t>(stats.f_bavail) * stats.f_frsize; |
+ *total_bytes = static_cast<uint64_t>(stats.f_blocks) * stats.f_frsize; |
+ return true; |
+} |
+ |
#if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
// static |
std::string SysInfo::OperatingSystemName() { |