| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BSD) || defined(OS_IOS) || (defined(OS_MACOSX) && \ | 24 #if defined(OS_BSD) || defined(OS_MACOSX) |
| 25 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) | |
| 26 typedef struct stat stat_wrapper_t; | 25 typedef struct stat stat_wrapper_t; |
| 27 static int CallFstat(int fd, stat_wrapper_t *sb) { | 26 static int CallFstat(int fd, stat_wrapper_t *sb) { |
| 28 base::ThreadRestrictions::AssertIOAllowed(); | 27 base::ThreadRestrictions::AssertIOAllowed(); |
| 29 return fstat(fd, sb); | 28 return fstat(fd, sb); |
| 30 } | 29 } |
| 31 #else | 30 #else |
| 32 typedef struct stat64 stat_wrapper_t; | 31 typedef struct stat64 stat_wrapper_t; |
| 33 static int CallFstat(int fd, stat_wrapper_t *sb) { | 32 static int CallFstat(int fd, stat_wrapper_t *sb) { |
| 34 base::ThreadRestrictions::AssertIOAllowed(); | 33 base::ThreadRestrictions::AssertIOAllowed(); |
| 35 return fstat64(fd, sb); | 34 return fstat64(fd, sb); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 info->is_directory = S_ISDIR(file_info.st_mode); | 276 info->is_directory = S_ISDIR(file_info.st_mode); |
| 278 info->is_symbolic_link = S_ISLNK(file_info.st_mode); | 277 info->is_symbolic_link = S_ISLNK(file_info.st_mode); |
| 279 info->size = file_info.st_size; | 278 info->size = file_info.st_size; |
| 280 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); | 279 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); |
| 281 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); | 280 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); |
| 282 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); | 281 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); |
| 283 return true; | 282 return true; |
| 284 } | 283 } |
| 285 | 284 |
| 286 } // namespace base | 285 } // namespace base |
| OLD | NEW |