Add use of QT_ENABLE_REGEXP_JIT env var to FAQ
[valgrind.git] / none / tests / linux / mremap6.c
blobbcebaf59a2a4f2d59697a68c94c1dd61d1496ce4
1 #define _GNU_SOURCE
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <assert.h>
5 #include <sys/ipc.h>
6 #include <sys/shm.h>
7 #include <sys/stat.h>
8 #include <sys/mman.h>
10 static void *mkmap(unsigned sz)
12 int shmid = shmget(IPC_PRIVATE, sz,
13 IPC_CREAT | IPC_EXCL | S_IRUSR | S_IWUSR);
14 assert(shmid != -1);
16 void *addr = shmat(shmid, NULL, 0);
17 assert(addr != (void *)-1);
19 return addr;
22 int main()
24 void *np, *p;
26 p = mkmap(1024*1024);
27 np = mremap(p, 1024*1024, 2048*1024, MREMAP_MAYMOVE); /* grow, maymove */
28 assert(np != (void *)-1);
30 return 0;