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_ANDROID) | 6 #if defined(HOST_OS_ANDROID) |
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 bool File::IsClosed() { | 77 bool File::IsClosed() { |
78 return handle_->fd() == kClosedFd; | 78 return handle_->fd() == kClosedFd; |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { | 82 MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { |
83 ASSERT(handle_->fd() >= 0); | 83 ASSERT(handle_->fd() >= 0); |
| 84 ASSERT(length > 0); |
84 int prot = PROT_NONE; | 85 int prot = PROT_NONE; |
85 switch (type) { | 86 switch (type) { |
86 case kReadOnly: | 87 case kReadOnly: |
87 prot = PROT_READ; | 88 prot = PROT_READ; |
88 break; | 89 break; |
89 case kReadExecute: | 90 case kReadExecute: |
90 prot = PROT_READ | PROT_EXEC; | 91 prot = PROT_READ | PROT_EXEC; |
91 break; | 92 break; |
92 default: | 93 default: |
93 return NULL; | 94 return NULL; |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 return ((file_1_info.st_ino == file_2_info.st_ino) && | 595 return ((file_1_info.st_ino == file_2_info.st_ino) && |
595 (file_1_info.st_dev == file_2_info.st_dev)) | 596 (file_1_info.st_dev == file_2_info.st_dev)) |
596 ? File::kIdentical | 597 ? File::kIdentical |
597 : File::kDifferent; | 598 : File::kDifferent; |
598 } | 599 } |
599 | 600 |
600 } // namespace bin | 601 } // namespace bin |
601 } // namespace dart | 602 } // namespace dart |
602 | 603 |
603 #endif // defined(HOST_OS_ANDROID) | 604 #endif // defined(HOST_OS_ANDROID) |
OLD | NEW |