OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. | 2 * Copyright (c) 2012 The Native Client Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /* | 7 /* |
8 * This file defines various POSIX-like functions directly using NaCl | 8 * This file defines various POSIX-like functions directly using NaCl |
9 * syscall trampolines. For normal application use, these are defined | 9 * syscall trampolines. For normal application use, these are defined |
10 * instead using the IRT function tables. Here we're defining the versions | 10 * instead using the IRT function tables. Here we're defining the versions |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 errno = -(int32_t) rv; | 99 errno = -(int32_t) rv; |
100 return MAP_FAILED; | 100 return MAP_FAILED; |
101 } | 101 } |
102 return (void *) (uintptr_t) rv; | 102 return (void *) (uintptr_t) rv; |
103 } | 103 } |
104 | 104 |
105 int munmap(void *start, size_t length) { | 105 int munmap(void *start, size_t length) { |
106 return errno_call(NACL_SYSCALL(munmap)(start, length)); | 106 return errno_call(NACL_SYSCALL(munmap)(start, length)); |
107 } | 107 } |
108 | 108 |
| 109 int mprotect(void *start, size_t length, int prot) { |
| 110 return errno_call(NACL_SYSCALL(mprotect)(start, length, prot)); |
| 111 } |
| 112 |
109 int open(char const *pathname, int oflag, ...) { | 113 int open(char const *pathname, int oflag, ...) { |
110 mode_t cmode; | 114 mode_t cmode; |
111 va_list ap; | 115 va_list ap; |
112 | 116 |
113 if (oflag & O_CREAT) { | 117 if (oflag & O_CREAT) { |
114 va_start(ap, oflag); | 118 va_start(ap, oflag); |
115 cmode = va_arg(ap, mode_t); | 119 cmode = va_arg(ap, mode_t); |
116 va_end(ap); | 120 va_end(ap); |
117 } else { | 121 } else { |
118 cmode = 0; | 122 cmode = 0; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 /* | 185 /* |
182 * These have to be weak because the IRT defines its own versions. | 186 * These have to be weak because the IRT defines its own versions. |
183 */ | 187 */ |
184 __attribute__((weak)) int nacl_tls_init(void *thread_ptr) { | 188 __attribute__((weak)) int nacl_tls_init(void *thread_ptr) { |
185 return -NACL_SYSCALL(tls_init)(thread_ptr); | 189 return -NACL_SYSCALL(tls_init)(thread_ptr); |
186 } | 190 } |
187 | 191 |
188 __attribute__((weak)) void *nacl_tls_get(void) { | 192 __attribute__((weak)) void *nacl_tls_get(void) { |
189 return NACL_SYSCALL(tls_get)(); | 193 return NACL_SYSCALL(tls_get)(); |
190 } | 194 } |
OLD | NEW |