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 #include "native_client/src/untrusted/irt/irt.h" | 7 #include "native_client/src/untrusted/irt/irt.h" |
8 #include "native_client/src/untrusted/irt/irt_interfaces.h" | 8 #include "native_client/src/untrusted/irt/irt_interfaces.h" |
9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" | 9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" |
10 | 10 |
11 static int nacl_irt_dev_getpid_func(int *pid) { | 11 static int nacl_irt_mprotect(void *addr, size_t len, int prot) { |
12 int rv = NACL_SYSCALL(getpid)(); | 12 return -NACL_SYSCALL(mprotect)(addr, len, prot); |
13 if (rv < 0) | |
14 return -rv; | |
15 *pid = rv; | |
16 return 0; | |
17 } | 13 } |
18 | 14 |
19 const struct nacl_irt_dev_getpid nacl_irt_dev_getpid = { | 15 const struct nacl_irt_dev_mprotect nacl_irt_dev_mprotect = { |
20 nacl_irt_dev_getpid_func, | 16 nacl_irt_mprotect, |
21 }; | 17 }; |
OLD | NEW |