Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/untrusted/irt/irt_dev_mprotect.c

Issue 11141016: mprotect system call exposed to the untrusted code. (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client
Patch Set: Split mprotect into separate dev interface. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <errno.h>
Mark Seaborn 2012/10/25 17:05:36 Nit: I don't think you need errno.h or stdint.h.
Petr Hosek 2012/10/25 18:46:57 Right, this is leftover.
8 #include <stdint.h>
9
7 #include "native_client/src/untrusted/irt/irt.h" 10 #include "native_client/src/untrusted/irt/irt.h"
8 #include "native_client/src/untrusted/irt/irt_interfaces.h" 11 #include "native_client/src/untrusted/irt/irt_interfaces.h"
9 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h" 12 #include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h"
10 13
11 static int nacl_irt_dev_getpid_func(int *pid) { 14 static int nacl_irt_mprotect(void *addr, size_t len, int prot) {
12 int rv = NACL_SYSCALL(getpid)(); 15 return -NACL_SYSCALL(mprotect)(addr, len, prot);
13 if (rv < 0)
14 return -rv;
15 *pid = rv;
16 return 0;
17 } 16 }
18 17
19 const struct nacl_irt_dev_getpid nacl_irt_dev_getpid = { 18 const struct nacl_irt_dev_mprotect nacl_irt_dev_mprotect = {
20 nacl_irt_dev_getpid_func, 19 nacl_irt_mprotect,
21 }; 20 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698