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 "vm/virtual_memory.h" | 5 #include "vm/virtual_memory.h" |
6 | 6 |
7 #include <sys/mman.h> | 7 #include <sys/mman.h> |
8 #include <sys/unistd.h> | |
9 #include <unistd.h> | 8 #include <unistd.h> |
10 | 9 |
11 #include "platform/assert.h" | 10 #include "platform/assert.h" |
12 #include "platform/utils.h" | 11 #include "platform/utils.h" |
13 | 12 |
14 namespace dart { | 13 namespace dart { |
15 | 14 |
16 // standard MAP_FAILED causes "error: use of old-style cast" as it | 15 // standard MAP_FAILED causes "error: use of old-style cast" as it |
17 // defines MAP_FAILED as ((void *) -1) | 16 // defines MAP_FAILED as ((void *) -1) |
18 #undef MAP_FAILED | 17 #undef MAP_FAILED |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 prot = PROT_READ | PROT_EXEC; | 88 prot = PROT_READ | PROT_EXEC; |
90 break; | 89 break; |
91 case kReadWriteExecute: | 90 case kReadWriteExecute: |
92 prot = PROT_READ | PROT_WRITE | PROT_EXEC; | 91 prot = PROT_READ | PROT_WRITE | PROT_EXEC; |
93 break; | 92 break; |
94 } | 93 } |
95 return (mprotect(address(), size(), prot) == 0); | 94 return (mprotect(address(), size(), prot) == 0); |
96 } | 95 } |
97 | 96 |
98 } // namespace dart | 97 } // namespace dart |
OLD | NEW |