OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 #ifndef BIN_FILE_H_ | 5 #ifndef BIN_FILE_H_ |
6 #define BIN_FILE_H_ | 6 #define BIN_FILE_H_ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <string.h> | 10 #include <string.h> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 kLockUnlock = 0, | 81 kLockUnlock = 0, |
82 kLockShared = 1, | 82 kLockShared = 1, |
83 kLockExclusive = 2, | 83 kLockExclusive = 2, |
84 kLockBlockingShared = 3, | 84 kLockBlockingShared = 3, |
85 kLockBlockingExclusive = 4, | 85 kLockBlockingExclusive = 4, |
86 kLockMax = 4 | 86 kLockMax = 4 |
87 }; | 87 }; |
88 | 88 |
89 intptr_t GetFD(); | 89 intptr_t GetFD(); |
90 | 90 |
91 void* MapExecutable(intptr_t* num_bytes); | 91 enum MapType { |
| 92 kReadOnly = 0, |
| 93 kReadExecute = 1, |
| 94 }; |
| 95 void* Map(MapType type, int64_t position, int64_t length); |
92 | 96 |
93 // Read/Write attempt to transfer num_bytes to/from buffer. It returns | 97 // Read/Write attempt to transfer num_bytes to/from buffer. It returns |
94 // the number of bytes read/written. | 98 // the number of bytes read/written. |
95 int64_t Read(void* buffer, int64_t num_bytes); | 99 int64_t Read(void* buffer, int64_t num_bytes); |
96 int64_t Write(const void* buffer, int64_t num_bytes); | 100 int64_t Write(const void* buffer, int64_t num_bytes); |
97 | 101 |
98 // ReadFully and WriteFully do attempt to transfer num_bytes to/from | 102 // ReadFully and WriteFully do attempt to transfer num_bytes to/from |
99 // the buffer. In the event of short accesses they will loop internally until | 103 // the buffer. In the event of short accesses they will loop internally until |
100 // the whole buffer has been transferred or an error occurs. If an error | 104 // the whole buffer has been transferred or an error occurs. If an error |
101 // occurred the result will be set to false. | 105 // occurred the result will be set to false. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 Dart_WeakPersistentHandle weak_handle_; | 238 Dart_WeakPersistentHandle weak_handle_; |
235 | 239 |
236 friend class ReferenceCounted<File>; | 240 friend class ReferenceCounted<File>; |
237 DISALLOW_COPY_AND_ASSIGN(File); | 241 DISALLOW_COPY_AND_ASSIGN(File); |
238 }; | 242 }; |
239 | 243 |
240 } // namespace bin | 244 } // namespace bin |
241 } // namespace dart | 245 } // namespace dart |
242 | 246 |
243 #endif // BIN_FILE_H_ | 247 #endif // BIN_FILE_H_ |
OLD | NEW |