aboutsummaryrefslogtreecommitdiff
path: root/sys/linux/src/mprotect.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/linux/src/mprotect.c')
-rw-r--r--sys/linux/src/mprotect.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/linux/src/mprotect.c b/sys/linux/src/mprotect.c
new file mode 100644
index 0000000..6d20dc1
--- /dev/null
+++ b/sys/linux/src/mprotect.c
@@ -0,0 +1,14 @@
+#include "internal.h"
+
+int
+sys·mprotect(void *addr, uintptr len, int prot)
+{
+ long ret;
+ uintptr beg, end;
+
+ beg = (uintptr)addr & -PAGESIZE;
+ end = (uintptr)(addr + len + PAGESIZE-1) & -PAGESIZE;
+
+ ret = syscall(·MProtect, beg, end-beg, prot);
+ return error(ret);
+}