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

Unified Diff: fusl/src/mman/mremap.c

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « fusl/src/mman/mprotect.c ('k') | fusl/src/mman/msync.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fusl/src/mman/mremap.c
diff --git a/fusl/src/mman/mremap.c b/fusl/src/mman/mremap.c
new file mode 100644
index 0000000000000000000000000000000000000000..ce4e8ea13677adc024dee57c21f810e6552c9c76
--- /dev/null
+++ b/fusl/src/mman/mremap.c
@@ -0,0 +1,33 @@
+#define _GNU_SOURCE
+#include <unistd.h>
+#include <sys/mman.h>
+#include <errno.h>
+#include <stdint.h>
+#include <stdarg.h>
+#include "syscall.h"
+#include "libc.h"
+
+static void dummy(void) { }
+weak_alias(dummy, __vm_wait);
+
+void *__mremap(void *old_addr, size_t old_len, size_t new_len, int flags, ...)
+{
+ va_list ap;
+ void *new_addr = 0;
+
+ if (new_len >= PTRDIFF_MAX) {
+ errno = ENOMEM;
+ return MAP_FAILED;
+ }
+
+ if (flags & MREMAP_FIXED) {
+ __vm_wait();
+ va_start(ap, flags);
+ new_addr = va_arg(ap, void *);
+ va_end(ap);
+ }
+
+ return (void *)syscall(SYS_mremap, old_addr, old_len, new_len, flags, new_addr);
+}
+
+weak_alias(__mremap, mremap);
« no previous file with comments | « fusl/src/mman/mprotect.c ('k') | fusl/src/mman/msync.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698