| 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_MACOS) | 6 #if defined(HOST_OS_MACOS) |
| 7 | 7 |
| 8 #include "bin/file.h" | 8 #include "bin/file.h" |
| 9 | 9 |
| 10 #include <copyfile.h> // NOLINT | 10 #include <copyfile.h> // NOLINT |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 | 78 |
| 79 bool File::IsClosed() { | 79 bool File::IsClosed() { |
| 80 return handle_->fd() == kClosedFd; | 80 return handle_->fd() == kClosedFd; |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { | 84 MappedMemory* File::Map(MapType type, int64_t position, int64_t length) { |
| 85 ASSERT(handle_->fd() >= 0); | 85 ASSERT(handle_->fd() >= 0); |
| 86 ASSERT(length > 0); |
| 86 int prot = PROT_NONE; | 87 int prot = PROT_NONE; |
| 87 switch (type) { | 88 switch (type) { |
| 88 case kReadOnly: | 89 case kReadOnly: |
| 89 prot = PROT_READ; | 90 prot = PROT_READ; |
| 90 break; | 91 break; |
| 91 case kReadExecute: | 92 case kReadExecute: |
| 92 prot = PROT_READ | PROT_EXEC; | 93 prot = PROT_READ | PROT_EXEC; |
| 93 break; | 94 break; |
| 94 default: | 95 default: |
| 95 return NULL; | 96 return NULL; |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 return ((file_1_info.st_ino == file_2_info.st_ino) && | 569 return ((file_1_info.st_ino == file_2_info.st_ino) && |
| 569 (file_1_info.st_dev == file_2_info.st_dev)) | 570 (file_1_info.st_dev == file_2_info.st_dev)) |
| 570 ? File::kIdentical | 571 ? File::kIdentical |
| 571 : File::kDifferent; | 572 : File::kDifferent; |
| 572 } | 573 } |
| 573 | 574 |
| 574 } // namespace bin | 575 } // namespace bin |
| 575 } // namespace dart | 576 } // namespace dart |
| 576 | 577 |
| 577 #endif // defined(HOST_OS_MACOS) | 578 #endif // defined(HOST_OS_MACOS) |
| OLD | NEW |