Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1666)

Unified Diff: platform.cc

Issue 6598074: DoAutomaticFreeDiskSpaceControl() introduced (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cryptohome.git@master
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « platform.h ('k') | service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform.cc
diff --git a/platform.cc b/platform.cc
index 35d0cdd690f3bbbc17ac910097adeb44fe671f8e..071e06a3b30937828fa8ad9734ccde1da3884715 100644
--- a/platform.cc
+++ b/platform.cc
@@ -12,6 +12,7 @@
#include <signal.h>
#include <sys/mount.h>
#include <sys/stat.h>
+#include <sys/statvfs.h>
#include <sys/types.h>
#include <base/file_util.h>
@@ -366,6 +367,14 @@ bool Platform::GetUserId(const std::string& user, uid_t* user_id,
return true;
}
+int64 Platform::AmountOfFreeDiskSpace(const string& path) {
+ struct statvfs stats;
+ if (statvfs(path.c_str(), &stats) != 0) {
+ return -1;
+ }
+ return static_cast<int64>(stats.f_bavail) * stats.f_frsize;
+}
+
void Platform::ClearUserKeyring() {
keyctl(KEYCTL_CLEAR, KEY_SPEC_USER_KEYRING);
}
« no previous file with comments | « platform.h ('k') | service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698