Index: runtime/bin/file_linux.cc |
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc |
index 26c047d4dbb097caa739ae3ad2a4a96ed785e4bd..7c4dddaa2421e0f770059ccc1432a36f7e0e9af1 100644 |
--- a/runtime/bin/file_linux.cc |
+++ b/runtime/bin/file_linux.cc |
@@ -202,6 +202,34 @@ off_t File::LengthFromPath(const char* name) { |
} |
+void File::Stat(const char* name, int64_t* data) { |
+ struct stat st; |
+ if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { |
+ if (S_ISREG(st.st_mode)) { |
+ data[kType] = kIsFile; |
+ } else if (S_ISDIR(st.st_mode)) { |
+ data[kType] = kIsDirectory; |
+ } else if (S_ISLNK(st.st_mode)) { |
+ data[kType] = kIsLink; |
+ } else { |
+ data[kType] = kDoesNotExist; |
+ } |
+ data[kCreatedTime] = st.st_ctime; |
+ data[kModifiedTime] = st.st_mtime; |
+ data[kAccessedTime] = st.st_atime; |
+ data[kMode] = st.st_mode; |
+ data[kSize] = st.st_size; |
+ } else { |
+ data[kType] = kDoesNotExist; |
+ data[kCreatedTime] = 0; |
+ data[kModifiedTime] = 0; |
+ data[kAccessedTime] = 0; |
+ data[kMode] = 0; |
+ data[kSize] = 0; |
+ } |
+} |
+ |
+ |
time_t File::LastModified(const char* name) { |
struct stat st; |
if (TEMP_FAILURE_RETRY(stat(name, &st)) == 0) { |