| 1879 | } |
| 1880 | |
| 1881 | virtual Status GetFileModifiedTime(const string& fname, int64_t* timestamp) override { |
| 1882 | TRACE_EVENT1("io", "PosixEnv::GetFileModifiedTime", "fname", fname); |
| 1883 | MAYBE_RETURN_EIO(fname, IOError(Env::kInjectedFailureStatusMsg, EIO)); |
| 1884 | ThreadRestrictions::AssertIOAllowed(); |
| 1885 | |
| 1886 | struct stat s; |
| 1887 | if (stat(fname.c_str(), &s) != 0) { |
| 1888 | return IOError(fname, errno); |
| 1889 | } |
| 1890 | #ifdef __APPLE__ |
| 1891 | *timestamp = s.st_mtimespec.tv_sec * 1000000 + s.st_mtimespec.tv_nsec / 1000; |
| 1892 | #else |
| 1893 | *timestamp = s.st_mtim.tv_sec * 1000000 + s.st_mtim.tv_nsec / 1000; |
| 1894 | #endif |
| 1895 | return Status::OK(); |
| 1896 | } |
| 1897 | |
| 1898 | // Local convenience function for safely running statvfs(). |
| 1899 | static Status StatVfs(const string& path, struct statvfs* buf) { |