s3-net: give more control how to update/register DNS entries.
[Samba/vl.git] / lib / replace / test / shared_mremap.c
blob05032ad12e3aa0feb755207ea032216e0665fe0a
1 /* this tests whether we can use mremap */
3 #if defined(HAVE_UNISTD_H)
4 #include <unistd.h>
5 #endif
6 #include <sys/mman.h>
7 #include <sys/types.h>
8 #include <sys/stat.h>
9 #include <fcntl.h>
11 #define DATA "conftest.mmap"
13 #ifndef MAP_FILE
14 #define MAP_FILE 0
15 #endif
17 #ifndef MAP_FAILED
18 #define MAP_FAILED (int *)-1
19 #endif
21 main()
23 int *buf;
24 int fd;
25 int err = 1;
27 fd = open(DATA, O_RDWR|O_CREAT|O_TRUNC, 0666);
28 if (fd == -1) {
29 exit(1);
32 buf = (int *)mmap(NULL, 0x1000, PROT_READ | PROT_WRITE,
33 MAP_FILE | MAP_SHARED, fd, 0);
34 if (buf == MAP_FAILED) {
35 goto done;
38 buf = mremap(buf, 0x1000, 0x2000, MREMAP_MAYMOVE);
39 if (buf == MAP_FAILED) {
40 goto done;
43 err = 0;
44 done:
45 close(fd);
46 unlink(DATA);
47 exit(err);