| 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_MACOS) | 6 #if defined(TARGET_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <copyfile.h> // NOLINT | 10 #include <copyfile.h> // NOLINT |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 return lseek(handle_->fd(), 0, SEEK_CUR); | 127 return lseek(handle_->fd(), 0, SEEK_CUR); |
| 128 } | 128 } |
| 129 | 129 |
| 130 | 130 |
| 131 bool File::SetPosition(int64_t position) { | 131 bool File::SetPosition(int64_t position) { |
| 132 ASSERT(handle_->fd() >= 0); | 132 ASSERT(handle_->fd() >= 0); |
| 133 return lseek(handle_->fd(), position, SEEK_SET) >= 0; | 133 return lseek(handle_->fd(), position, SEEK_SET) >= 0; |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 // There is no difference between binary and text translation modes on this |
| 138 // platform, so this operation is a no-op. |
| 139 void File::SetTranslation(DartFileTranslation translation) {} |
| 140 |
| 141 |
| 137 bool File::Truncate(int64_t length) { | 142 bool File::Truncate(int64_t length) { |
| 138 ASSERT(handle_->fd() >= 0); | 143 ASSERT(handle_->fd() >= 0); |
| 139 return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length)) != -1; | 144 return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length)) != -1; |
| 140 } | 145 } |
| 141 | 146 |
| 142 | 147 |
| 143 bool File::Flush() { | 148 bool File::Flush() { |
| 144 ASSERT(handle_->fd() >= 0); | 149 ASSERT(handle_->fd() >= 0); |
| 145 return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; | 150 return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; |
| 146 } | 151 } |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 return ((file_1_info.st_ino == file_2_info.st_ino) && | 556 return ((file_1_info.st_ino == file_2_info.st_ino) && |
| 552 (file_1_info.st_dev == file_2_info.st_dev)) | 557 (file_1_info.st_dev == file_2_info.st_dev)) |
| 553 ? File::kIdentical | 558 ? File::kIdentical |
| 554 : File::kDifferent; | 559 : File::kDifferent; |
| 555 } | 560 } |
| 556 | 561 |
| 557 } // namespace bin | 562 } // namespace bin |
| 558 } // namespace dart | 563 } // namespace dart |
| 559 | 564 |
| 560 #endif // defined(TARGET_OS_MACOS) | 565 #endif // defined(TARGET_OS_MACOS) |
| OLD | NEW |