#include #include #include #include #include main(int argc,char *argv[]) { unsigned long siz, procs, itterations, cow; char *ptr1; char *i; int pid, j, k, status; if ((argc <= 1)||(argc >4)) { printf("bad args, usage: forkoff #children #itterations cow:0|1\n"); exit(-1); } siz = ((long)atol(argv[1])*1024*1024*1024); procs = atol(argv[2]); itterations = atol(argv[3]); cow = atol(argv[4]); printf("mmaping %ld anonymous bytes\n", siz); ptr1 = (char *)mmap((void *)0,siz,PROT_READ|PROT_WRITE,MAP_ANONYMOUS|MAP_PRIVATE,-1,0); if (ptr1 == (char *)-1) { printf("ptr1 = %lx\n", ptr1); perror(""); } if (cow) { printf("priming parent for child COW faults\n"); // This will cause the ZFOD faults in the parent & COW faults in the children. for (i=ptr1; i