make vfs & filesystems use failable copying
[minix3.git] / test / test64.c
blob0e2f1351c92677f93f1529128b60886f37b470fc
2 /* Code to test reasonable response to out-of-memory condition
3 * of regular processes.
4 */
6 #include <stdlib.h>
7 #include <stdio.h>
8 #include <dlfcn.h>
10 #include <sys/mman.h>
11 #include <sys/wait.h>
13 int max_error = 2;
14 #include "common.h"
17 #include "magic.h"
19 int main (int argc, char *argv[])
21 pid_t f;
22 start(64);
23 #define NADDRS 500
24 #define LEN 4096
25 static void *addrs[NADDRS];
26 int i = 0;
27 int st;
29 if((f=fork()) == -1) {
30 e(1);
31 exit(1);
34 if(f == 0) {
35 /* child: use up as much memory as we can */
36 while((addrs[i++ % NADDRS] = mmap(0, LEN, PROT_READ|PROT_WRITE,
37 MAP_PREALLOC|MAP_CONTIG|MAP_ANON, -1, 0)) != MAP_FAILED)
39 exit(0);
42 /* parent: wait for child */
43 if(waitpid(f, &st, 0) < 0)
44 perror("waitpid");
46 quit();
48 return(0);