| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 int stat_success; | 444 int stat_success; |
| 445 if (follow_links) { | 445 if (follow_links) { |
| 446 stat_success = TEMP_FAILURE_RETRY(stat64(pathname, &entry_info)); | 446 stat_success = TEMP_FAILURE_RETRY(stat64(pathname, &entry_info)); |
| 447 } else { | 447 } else { |
| 448 stat_success = TEMP_FAILURE_RETRY(lstat64(pathname, &entry_info)); | 448 stat_success = TEMP_FAILURE_RETRY(lstat64(pathname, &entry_info)); |
| 449 } | 449 } |
| 450 if (stat_success == -1) return File::kDoesNotExist; | 450 if (stat_success == -1) return File::kDoesNotExist; |
| 451 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; | 451 if (S_ISDIR(entry_info.st_mode)) return File::kIsDirectory; |
| 452 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; | 452 if (S_ISREG(entry_info.st_mode)) return File::kIsFile; |
| 453 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; | 453 if (S_ISLNK(entry_info.st_mode)) return File::kIsLink; |
| 454 if (S_ISSOCK(entry_info.st_mode)) return File::kIsFile; // HACK. |
| 454 return File::kDoesNotExist; | 455 return File::kDoesNotExist; |
| 455 } | 456 } |
| 456 | 457 |
| 457 | 458 |
| 458 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { | 459 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { |
| 459 struct stat64 file_1_info; | 460 struct stat64 file_1_info; |
| 460 struct stat64 file_2_info; | 461 struct stat64 file_2_info; |
| 461 if (TEMP_FAILURE_RETRY(lstat64(file_1, &file_1_info)) == -1 || | 462 if (TEMP_FAILURE_RETRY(lstat64(file_1, &file_1_info)) == -1 || |
| 462 TEMP_FAILURE_RETRY(lstat64(file_2, &file_2_info)) == -1) { | 463 TEMP_FAILURE_RETRY(lstat64(file_2, &file_2_info)) == -1) { |
| 463 return File::kError; | 464 return File::kError; |
| 464 } | 465 } |
| 465 return (file_1_info.st_ino == file_2_info.st_ino && | 466 return (file_1_info.st_ino == file_2_info.st_ino && |
| 466 file_1_info.st_dev == file_2_info.st_dev) ? | 467 file_1_info.st_dev == file_2_info.st_dev) ? |
| 467 File::kIdentical : | 468 File::kIdentical : |
| 468 File::kDifferent; | 469 File::kDifferent; |
| 469 } | 470 } |
| 470 | 471 |
| 471 } // namespace bin | 472 } // namespace bin |
| 472 } // namespace dart | 473 } // namespace dart |
| 473 | 474 |
| 474 #endif // defined(TARGET_OS_LINUX) | 475 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |