#define MAP_ANONYMOUS MAP_ANON
#endif
+#ifndef __linux__
+
+#define MREMAP_MAYMOVE 1
+#define MREMAP_FIXED 2
+
+/*
+ * mremap wrapper for non-Linux systems. Maps a RW, anonymous private mapping.
+ * This is not generic.
+*/
+void *mremap(void *old_address, size_t old_size, size_t new_size, int flags)
+{
+ void *new_arena;
+
+ assert(flags & MREMAP_MAYMOVE);
+ assert(!(flags & MREMAP_FIXED));
+ new_address = mmap(old_address, new_size,
+ PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_PRIVATE,
+ -1, 0);
+ if (new_address == MAP_FAILED)
+ return MAP_FAILED;
+ if (old_address) {
+ memcpy(new_address, old_address, old_size);
+ munmap(old_address, old_size);
+ }
+ return new_address;
+}
+#endif
+
/* Sleep delay in us */
#define RCU_SLEEP_DELAY 1000
#define ARENA_INIT_ALLOC 16