| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/platform_file.h" | 5 #include "base/platform_file.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <errno.h> | 8 #include <errno.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| 11 | 11 |
| 12 #include "base/eintr_wrapper.h" | 12 #include "base/eintr_wrapper.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/threading/thread_restrictions.h" | 15 #include "base/threading/thread_restrictions.h" |
| 16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
| 17 | 17 |
| 18 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
| 19 #include "base/os_compat_android.h" | 19 #include "base/os_compat_android.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 | 23 |
| 24 #if defined(OS_OPENBSD) || defined(OS_FREEBSD) || \ | 24 #if defined(OS_BSD) || (defined(OS_MACOSX) && \ |
| 25 (defined(OS_MACOSX) && \ | 25 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) |
| 26 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) | |
| 27 typedef struct stat stat_wrapper_t; | 26 typedef struct stat stat_wrapper_t; |
| 28 static int CallFstat(int fd, stat_wrapper_t *sb) { | 27 static int CallFstat(int fd, stat_wrapper_t *sb) { |
| 29 base::ThreadRestrictions::AssertIOAllowed(); | 28 base::ThreadRestrictions::AssertIOAllowed(); |
| 30 return fstat(fd, sb); | 29 return fstat(fd, sb); |
| 31 } | 30 } |
| 32 #else | 31 #else |
| 33 typedef struct stat64 stat_wrapper_t; | 32 typedef struct stat64 stat_wrapper_t; |
| 34 static int CallFstat(int fd, stat_wrapper_t *sb) { | 33 static int CallFstat(int fd, stat_wrapper_t *sb) { |
| 35 base::ThreadRestrictions::AssertIOAllowed(); | 34 base::ThreadRestrictions::AssertIOAllowed(); |
| 36 return fstat64(fd, sb); | 35 return fstat64(fd, sb); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 info->is_directory = S_ISDIR(file_info.st_mode); | 232 info->is_directory = S_ISDIR(file_info.st_mode); |
| 234 info->is_symbolic_link = S_ISLNK(file_info.st_mode); | 233 info->is_symbolic_link = S_ISLNK(file_info.st_mode); |
| 235 info->size = file_info.st_size; | 234 info->size = file_info.st_size; |
| 236 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); | 235 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); |
| 237 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); | 236 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); |
| 238 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); | 237 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); |
| 239 return true; | 238 return true; |
| 240 } | 239 } |
| 241 | 240 |
| 242 } // namespace base | 241 } // namespace base |
| OLD | NEW |