aboutsummaryrefslogtreecommitdiff
path: root/sys/src/mremap.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-11-18 13:18:38 -0800
committerNicholas Noll <nbnoll@eml.cc>2021-11-18 13:18:38 -0800
commit4bf477d5ed372fd44697d2f0df245b61b4f3f7b3 (patch)
treee52d8aa00de40b33c4f26cacba6841f299f97bb2 /sys/src/mremap.c
parent8306b655f9d9a291126ed4947c481ea540c9b835 (diff)
filling out system layer
Diffstat (limited to 'sys/src/mremap.c')
-rw-r--r--sys/src/mremap.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/sys/src/mremap.c b/sys/src/mremap.c
new file mode 100644
index 0000000..dda05ce
--- /dev/null
+++ b/sys/src/mremap.c
@@ -0,0 +1,20 @@
+#include "internal.h"
+
+int
+sys·mremap(void *addr, uintptr from, uintptr to, int flags, void **ret)
+{
+ long r;
+ void *new;
+
+ if(to >= PTRDIFF_MAX)
+ return sys·ErrorNoMemory;
+
+ new = (flags & sys·RemapFixed) ? *ret : nil;
+ r = syscall(·MRemap, addr, from, to, flags, new);
+ if(r > 0){
+ *ret = (void*)r;
+ return 0;
+ }
+
+ return error(r);
+}