| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 <errno.h> | 5 #include <errno.h> |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <sys/stat.h> | 7 #include <sys/stat.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 #include <libgen.h> | 9 #include <libgen.h> |
| 10 | 10 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return write(handle_->fd(), buffer, num_bytes); | 65 return write(handle_->fd(), buffer, num_bytes); |
| 66 } | 66 } |
| 67 | 67 |
| 68 | 68 |
| 69 off_t File::Position() { | 69 off_t File::Position() { |
| 70 ASSERT(handle_->fd() >= 0); | 70 ASSERT(handle_->fd() >= 0); |
| 71 return lseek(handle_->fd(), 0, SEEK_CUR); | 71 return lseek(handle_->fd(), 0, SEEK_CUR); |
| 72 } | 72 } |
| 73 | 73 |
| 74 | 74 |
| 75 off_t File::SetPosition(int64_t position) { |
| 76 ASSERT(handle_->fd() >= 0); |
| 77 return lseek(handle_->fd(), position, SEEK_SET); |
| 78 } |
| 79 |
| 80 |
| 75 void File::Flush() { | 81 void File::Flush() { |
| 76 ASSERT(handle_->fd() >= 0); | 82 ASSERT(handle_->fd() >= 0); |
| 77 fsync(handle_->fd()); | 83 fsync(handle_->fd()); |
| 78 } | 84 } |
| 79 | 85 |
| 80 | 86 |
| 81 off_t File::Length() { | 87 off_t File::Length() { |
| 82 ASSERT(handle_->fd() >= 0); | 88 ASSERT(handle_->fd() >= 0); |
| 83 off_t position = lseek(handle_->fd(), 0, SEEK_CUR); | 89 off_t position = lseek(handle_->fd(), 0, SEEK_CUR); |
| 84 if (position < 0) { | 90 if (position < 0) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 145 |
| 140 | 146 |
| 141 const char* File::PathSeparator() { | 147 const char* File::PathSeparator() { |
| 142 return "/"; | 148 return "/"; |
| 143 } | 149 } |
| 144 | 150 |
| 145 | 151 |
| 146 const char* File::StringEscapedPathSeparator() { | 152 const char* File::StringEscapedPathSeparator() { |
| 147 return "/"; | 153 return "/"; |
| 148 } | 154 } |
| OLD | NEW |