OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_FUCHSIA) | 6 #if defined(TARGET_OS_FUCHSIA) |
7 | 7 |
8 #include "bin/file.h" | 8 #include "bin/file.h" |
9 | 9 |
10 #include <errno.h> // NOLINT | 10 #include <errno.h> // NOLINT |
11 #include <fcntl.h> // NOLINT | 11 #include <fcntl.h> // NOLINT |
12 #include <libgen.h> // NOLINT | 12 #include <libgen.h> // NOLINT |
13 #include <sys/mman.h> // NOLINT | 13 #include <sys/mman.h> // NOLINT |
14 #include <sys/stat.h> // NOLINT | 14 #include <sys/stat.h> // NOLINT |
15 #include <sys/types.h> // NOLINT | 15 #include <sys/types.h> // NOLINT |
16 #include <unistd.h> // NOLINT | 16 #include <unistd.h> // NOLINT |
17 | 17 |
18 #include "bin/builtin.h" | 18 #include "bin/builtin.h" |
19 #include "bin/log.h" | 19 #include "bin/log.h" |
20 #include "platform/signal_blocker.h" | 20 #include "platform/signal_blocker.h" |
21 #include "platform/utils.h" | 21 #include "platform/utils.h" |
22 | 22 |
23 namespace dart { | 23 namespace dart { |
24 namespace bin { | 24 namespace bin { |
25 | 25 |
26 class FileHandle { | 26 class FileHandle { |
27 public: | 27 public: |
28 explicit FileHandle(int fd) : fd_(fd) { } | 28 explicit FileHandle(int fd) : fd_(fd) {} |
29 ~FileHandle() { } | 29 ~FileHandle() {} |
30 int fd() const { return fd_; } | 30 int fd() const { return fd_; } |
31 void set_fd(int fd) { fd_ = fd; } | 31 void set_fd(int fd) { fd_ = fd; } |
32 | 32 |
33 private: | 33 private: |
34 int fd_; | 34 int fd_; |
35 | 35 |
36 DISALLOW_COPY_AND_ASSIGN(FileHandle); | 36 DISALLOW_COPY_AND_ASSIGN(FileHandle); |
37 }; | 37 }; |
38 | 38 |
39 | 39 |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 428 |
429 | 429 |
430 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { | 430 File::Identical File::AreIdentical(const char* file_1, const char* file_2) { |
431 struct stat file_1_info; | 431 struct stat file_1_info; |
432 struct stat file_2_info; | 432 struct stat file_2_info; |
433 if ((NO_RETRY_EXPECTED(lstat(file_1, &file_1_info)) == -1) || | 433 if ((NO_RETRY_EXPECTED(lstat(file_1, &file_1_info)) == -1) || |
434 (NO_RETRY_EXPECTED(lstat(file_2, &file_2_info)) == -1)) { | 434 (NO_RETRY_EXPECTED(lstat(file_2, &file_2_info)) == -1)) { |
435 return File::kError; | 435 return File::kError; |
436 } | 436 } |
437 return ((file_1_info.st_ino == file_2_info.st_ino) && | 437 return ((file_1_info.st_ino == file_2_info.st_ino) && |
438 (file_1_info.st_dev == file_2_info.st_dev)) ? | 438 (file_1_info.st_dev == file_2_info.st_dev)) |
439 File::kIdentical : | 439 ? File::kIdentical |
440 File::kDifferent; | 440 : File::kDifferent; |
441 } | 441 } |
442 | 442 |
443 } // namespace bin | 443 } // namespace bin |
444 } // namespace dart | 444 } // namespace dart |
445 | 445 |
446 #endif // defined(TARGET_OS_FUCHSIA) | 446 #endif // defined(TARGET_OS_FUCHSIA) |
OLD | NEW |