| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (err != 0) { | 56 if (err != 0) { |
| 57 const int kBufferSize = 1024; | 57 const int kBufferSize = 1024; |
| 58 char error_buf[kBufferSize]; | 58 char error_buf[kBufferSize]; |
| 59 Log::PrintErr("%s\n", strerror_r(errno, error_buf, kBufferSize)); | 59 Log::PrintErr("%s\n", strerror_r(errno, error_buf, kBufferSize)); |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 handle_->set_fd(kClosedFd); | 62 handle_->set_fd(kClosedFd); |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 intptr_t File::GetFD() { |
| 67 return handle_->fd(); |
| 68 } |
| 69 |
| 70 |
| 66 bool File::IsClosed() { | 71 bool File::IsClosed() { |
| 67 return handle_->fd() == kClosedFd; | 72 return handle_->fd() == kClosedFd; |
| 68 } | 73 } |
| 69 | 74 |
| 70 | 75 |
| 71 int64_t File::Read(void* buffer, int64_t num_bytes) { | 76 int64_t File::Read(void* buffer, int64_t num_bytes) { |
| 72 ASSERT(handle_->fd() >= 0); | 77 ASSERT(handle_->fd() >= 0); |
| 73 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); | 78 return TEMP_FAILURE_RETRY(read(handle_->fd(), buffer, num_bytes)); |
| 74 } | 79 } |
| 75 | 80 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 return (file_1_info.st_ino == file_2_info.st_ino && | 426 return (file_1_info.st_ino == file_2_info.st_ino && |
| 422 file_1_info.st_dev == file_2_info.st_dev) ? | 427 file_1_info.st_dev == file_2_info.st_dev) ? |
| 423 File::kIdentical : | 428 File::kIdentical : |
| 424 File::kDifferent; | 429 File::kDifferent; |
| 425 } | 430 } |
| 426 | 431 |
| 427 } // namespace bin | 432 } // namespace bin |
| 428 } // namespace dart | 433 } // namespace dart |
| 429 | 434 |
| 430 #endif // defined(TARGET_OS_LINUX) | 435 #endif // defined(TARGET_OS_LINUX) |
| OLD | NEW |