use anonymous maps in vmfill
[libc-test.git] / src / common / memfill.c
blobc53bfeac45c35d5ad1c7f8084e6c8c6088acb031
1 #include <stdlib.h>
2 #include <string.h>
3 #include <errno.h>
4 #include <sys/resource.h>
5 #include "test.h"
7 int t_memfill()
9 int r = 0;
10 /* alloc mmap space with PROT_NONE */
11 if (t_vmfill(0,0,0) < 0) {
12 t_error("vmfill failed: %s\n", strerror(errno));
13 r = -1;
15 /* limit brk space */
16 if (t_setrlim(RLIMIT_DATA, 0) < 0)
17 r = -1;
18 if (!r)
19 /* use up libc reserves if any */
20 while (malloc(1));
21 return r;