| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 #if defined(TARGET_OS_LINUX) | 6 #if defined(TARGET_OS_LINUX) |
| 7 | 7 |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 data[kSize] = st.st_size; | 412 data[kSize] = st.st_size; |
| 413 } else { | 413 } else { |
| 414 data[kType] = kDoesNotExist; | 414 data[kType] = kDoesNotExist; |
| 415 } | 415 } |
| 416 } | 416 } |
| 417 | 417 |
| 418 | 418 |
| 419 time_t File::LastModified(const char* name) { | 419 time_t File::LastModified(const char* name) { |
| 420 struct stat64 st; | 420 struct stat64 st; |
| 421 if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) { | 421 if (TEMP_FAILURE_RETRY(stat64(name, &st)) == 0) { |
| 422 // Signal an error if it's a directory. |
| 423 if (S_ISDIR(st.st_mode)) { |
| 424 errno = EISDIR; |
| 425 return -1; |
| 426 } |
| 427 // Otherwise assume the caller knows what it's doing. |
| 422 return st.st_mtime; | 428 return st.st_mtime; |
| 423 } | 429 } |
| 424 return -1; | 430 return -1; |
| 425 } | 431 } |
| 426 | 432 |
| 427 | 433 |
| 428 const char* File::LinkTarget(const char* pathname) { | 434 const char* File::LinkTarget(const char* pathname) { |
| 429 struct stat64 link_stats; | 435 struct stat64 link_stats; |
| 430 if (TEMP_FAILURE_RETRY(lstat64(pathname, &link_stats)) != 0) { | 436 if (TEMP_FAILURE_RETRY(lstat64(pathname, &link_stats)) != 0) { |
| 431 return NULL; | 437 return NULL; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 return ((file_1_info.st_ino == file_2_info.st_ino) && | 548 return ((file_1_info.st_ino == file_2_info.st_ino) && |
| 543 (file_1_info.st_dev == file_2_info.st_dev)) | 549 (file_1_info.st_dev == file_2_info.st_dev)) |
| 544 ? File::kIdentical | 550 ? File::kIdentical |
| 545 : File::kDifferent; | 551 : File::kDifferent; |
| 546 } | 552 } |
| 547 | 553 |
| 548 } // namespace bin | 554 } // namespace bin |
| 549 } // namespace dart | 555 } // namespace dart |
| 550 | 556 |
| 551 #endif // defined(TARGET_OS_LINUX) | 557 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |