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 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 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 return ((file_1_info.st_ino == file_2_info.st_ino) && | 607 return ((file_1_info.st_ino == file_2_info.st_ino) && |
607 (file_1_info.st_dev == file_2_info.st_dev)) | 608 (file_1_info.st_dev == file_2_info.st_dev)) |
608 ? File::kIdentical | 609 ? File::kIdentical |
609 : File::kDifferent; | 610 : File::kDifferent; |
610 } | 611 } |
611 | 612 |
612 } // namespace bin | 613 } // namespace bin |
613 } // namespace dart | 614 } // namespace dart |
614 | 615 |
615 #endif // defined(HOST_OS_LINUX) | 616 #endif // defined(HOST_OS_LINUX) |
OLD | NEW |