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_LINUX) | 6 #if defined(HOST_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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); | 145 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), 0, SEEK_CUR)); |
146 } | 146 } |
147 | 147 |
148 | 148 |
149 bool File::SetPosition(int64_t position) { | 149 bool File::SetPosition(int64_t position) { |
150 ASSERT(handle_->fd() >= 0); | 150 ASSERT(handle_->fd() >= 0); |
151 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0; | 151 return NO_RETRY_EXPECTED(lseek64(handle_->fd(), position, SEEK_SET)) >= 0; |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 // There is no difference between binary and text translation modes on this | |
156 // platform, so this operation is a no-op. | |
157 void File::SetTranslation(DartFileTranslation translation) {} | |
158 | |
159 | |
160 bool File::Truncate(int64_t length) { | 155 bool File::Truncate(int64_t length) { |
161 ASSERT(handle_->fd() >= 0); | 156 ASSERT(handle_->fd() >= 0); |
162 return TEMP_FAILURE_RETRY(ftruncate64(handle_->fd(), length) != -1); | 157 return TEMP_FAILURE_RETRY(ftruncate64(handle_->fd(), length) != -1); |
163 } | 158 } |
164 | 159 |
165 | 160 |
166 bool File::Flush() { | 161 bool File::Flush() { |
167 ASSERT(handle_->fd() >= 0); | 162 ASSERT(handle_->fd() >= 0); |
168 return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; | 163 return NO_RETRY_EXPECTED(fsync(handle_->fd())) != -1; |
169 } | 164 } |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 return ((file_1_info.st_ino == file_2_info.st_ino) && | 609 return ((file_1_info.st_ino == file_2_info.st_ino) && |
615 (file_1_info.st_dev == file_2_info.st_dev)) | 610 (file_1_info.st_dev == file_2_info.st_dev)) |
616 ? File::kIdentical | 611 ? File::kIdentical |
617 : File::kDifferent; | 612 : File::kDifferent; |
618 } | 613 } |
619 | 614 |
620 } // namespace bin | 615 } // namespace bin |
621 } // namespace dart | 616 } // namespace dart |
622 | 617 |
623 #endif // defined(HOST_OS_LINUX) | 618 #endif // defined(HOST_OS_LINUX) |
OLD | NEW |