drd/tests/swapcontext: Improve the portability of this test further
[valgrind.git] / none / tests / linux / mremap5.c
blobdcea248d78d5c348fbd4d796c0e3db54ef390d64
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 int main()
12 int shmid = shmget(IPC_PRIVATE, 100 * 4096,
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 addr = mremap(addr, 100 * 4096, 400 * 4096, MREMAP_MAYMOVE);
20 assert(addr != (void *)-1);
22 return 0;