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> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 break; | 153 break; |
154 default: | 154 default: |
155 *error = PLATFORM_FILE_ERROR_FAILED; | 155 *error = PLATFORM_FILE_ERROR_FAILED; |
156 } | 156 } |
157 } | 157 } |
158 } | 158 } |
159 | 159 |
160 return descriptor; | 160 return descriptor; |
161 } | 161 } |
162 | 162 |
| 163 FILE* FdopenPlatformFile(PlatformFile file, const char* mode) { |
| 164 base::ThreadRestrictions::AssertIOAllowed(); |
| 165 return fdopen(file, mode); |
| 166 } |
| 167 |
163 bool ClosePlatformFile(PlatformFile file) { | 168 bool ClosePlatformFile(PlatformFile file) { |
164 base::ThreadRestrictions::AssertIOAllowed(); | 169 base::ThreadRestrictions::AssertIOAllowed(); |
165 return !HANDLE_EINTR(close(file)); | 170 return !HANDLE_EINTR(close(file)); |
166 } | 171 } |
167 | 172 |
168 int64 SeekPlatformFile(PlatformFile file, | 173 int64 SeekPlatformFile(PlatformFile file, |
169 PlatformFileWhence whence, | 174 PlatformFileWhence whence, |
170 int64 offset) { | 175 int64 offset) { |
171 base::ThreadRestrictions::AssertIOAllowed(); | 176 base::ThreadRestrictions::AssertIOAllowed(); |
172 if (file < 0 || offset < 0) | 177 if (file < 0 || offset < 0) |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 info->is_directory = S_ISDIR(file_info.st_mode); | 316 info->is_directory = S_ISDIR(file_info.st_mode); |
312 info->is_symbolic_link = S_ISLNK(file_info.st_mode); | 317 info->is_symbolic_link = S_ISLNK(file_info.st_mode); |
313 info->size = file_info.st_size; | 318 info->size = file_info.st_size; |
314 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); | 319 info->last_modified = base::Time::FromTimeT(file_info.st_mtime); |
315 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); | 320 info->last_accessed = base::Time::FromTimeT(file_info.st_atime); |
316 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); | 321 info->creation_time = base::Time::FromTimeT(file_info.st_ctime); |
317 return true; | 322 return true; |
318 } | 323 } |
319 | 324 |
320 } // namespace base | 325 } // namespace base |
OLD | NEW |