/* Mark the new area based on the old seg. */
if (seg.kind == SkFileC) {
seg.offset += ((ULong)old_addr) - ((ULong)seg.start);
- } else {
- aspacem_assert(seg.kind == SkAnonC);
- aspacem_assert(seg.offset == 0);
}
seg.start = new_addr;
seg.end = new_addr + new_len - 1;
mremap3.stderr.exp mremap3.stdout.exp mremap3.vgtest \
mremap4.stderr.exp mremap4.vgtest \
mremap5.stderr.exp mremap5.vgtest \
+ mremap6.stderr.exp mremap6.vgtest \
pthread-stack.stderr.exp pthread-stack.vgtest \
stack-overflow.stderr.exp stack-overflow.vgtest
mremap3 \
mremap4 \
mremap5 \
+ mremap6 \
pthread-stack \
stack-overflow
--- /dev/null
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+#include <sys/ipc.h>
+#include <sys/shm.h>
+#include <sys/stat.h>
+#include <sys/mman.h>
+
+static void *mkmap(unsigned sz)
+{
+ int shmid = shmget(IPC_PRIVATE, sz,
+ IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR);
+ assert(shmid != -1);
+
+ void *addr = shmat(shmid, NULL, 0);
+ assert(addr != (void *)-1);
+
+ return addr;
+}
+
+int main()
+{
+ void *np, *p;
+
+ p = mkmap(1024*1024);
+ np = mremap(p, 1024*1024, 2048*1024, MREMAP_MAYMOVE); /* grow, maymove */
+ assert(np != (void *)-1);
+
+ return 0;
+}
--- /dev/null
+prog: mremap6
+vgopts: -q
+# This testcase used to run into an assertion. Therefore cannot use
+# the default filter because need to see lines beginning with --<pid> .....
+stderr_filter: ../../../tests/filter_addresses