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(HOST_OS_MACOS) | 6 #if defined(HOST_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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 return lseek(handle_->fd(), 0, SEEK_CUR); | 147 return lseek(handle_->fd(), 0, SEEK_CUR); |
148 } | 148 } |
149 | 149 |
150 | 150 |
151 bool File::SetPosition(int64_t position) { | 151 bool File::SetPosition(int64_t position) { |
152 ASSERT(handle_->fd() >= 0); | 152 ASSERT(handle_->fd() >= 0); |
153 return lseek(handle_->fd(), position, SEEK_SET) >= 0; | 153 return lseek(handle_->fd(), position, SEEK_SET) >= 0; |
154 } | 154 } |
155 | 155 |
156 | 156 |
157 // There is no difference between binary and text translation modes on this | |
158 // platform, so this operation is a no-op. | |
159 void File::SetTranslation(DartFileTranslation translation) {} | |
160 | |
161 | |
162 bool File::Truncate(int64_t length) { | 157 bool File::Truncate(int64_t length) { |
163 ASSERT(handle_->fd() >= 0); | 158 ASSERT(handle_->fd() >= 0); |
164 return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length)) != -1; | 159 return TEMP_FAILURE_RETRY(ftruncate(handle_->fd(), length)) != -1; |
165 } | 160 } |
166 | 161 |
167 | 162 |
168 bool File::Flush() { | 163 bool File::Flush() { |
169 ASSERT(handle_->fd() >= 0); | 164 ASSERT(handle_->fd() >= 0); |
170 return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; | 165 return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; |
171 } | 166 } |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 return ((file_1_info.st_ino == file_2_info.st_ino) && | 571 return ((file_1_info.st_ino == file_2_info.st_ino) && |
577 (file_1_info.st_dev == file_2_info.st_dev)) | 572 (file_1_info.st_dev == file_2_info.st_dev)) |
578 ? File::kIdentical | 573 ? File::kIdentical |
579 : File::kDifferent; | 574 : File::kDifferent; |
580 } | 575 } |
581 | 576 |
582 } // namespace bin | 577 } // namespace bin |
583 } // namespace dart | 578 } // namespace dart |
584 | 579 |
585 #endif // defined(HOST_OS_MACOS) | 580 #endif // defined(HOST_OS_MACOS) |
OLD | NEW |