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

Unified 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, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: src/untrusted/irt/irt_dev_mprotect.c
diff --git a/src/untrusted/irt/irt_dev_getpid.c b/src/untrusted/irt/irt_dev_mprotect.c
similarity index 60%
copy from src/untrusted/irt/irt_dev_getpid.c
copy to src/untrusted/irt/irt_dev_mprotect.c
index 8360fc8eecbf6015a38f4b39c545fa1028851e31..d5edff7d6c07af609d4f34651aef4f4f5d194163 100644
--- a/src/untrusted/irt/irt_dev_getpid.c
+++ b/src/untrusted/irt/irt_dev_mprotect.c
@@ -4,18 +4,17 @@
* found in the LICENSE file.
*/
+#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.
+#include <stdint.h>
+
#include "native_client/src/untrusted/irt/irt.h"
#include "native_client/src/untrusted/irt/irt_interfaces.h"
#include "native_client/src/untrusted/nacl/syscall_bindings_trampoline.h"
-static int nacl_irt_dev_getpid_func(int *pid) {
- int rv = NACL_SYSCALL(getpid)();
- if (rv < 0)
- return -rv;
- *pid = rv;
- return 0;
+static int nacl_irt_mprotect(void *addr, size_t len, int prot) {
+ return -NACL_SYSCALL(mprotect)(addr, len, prot);
}
-const struct nacl_irt_dev_getpid nacl_irt_dev_getpid = {
- nacl_irt_dev_getpid_func,
+const struct nacl_irt_dev_mprotect nacl_irt_dev_mprotect = {
+ nacl_irt_mprotect,
};

Powered by Google App Engine
This is Rietveld 408576698