/* * simple test of swappin with anonymous shared mmaping * cw@f00f.org */ #include #include #include #include #include /* must be >= physical memory size */ #define MS ((768+10)*1024*1024) int main() { char *buf; size_t ps; size_t i; int status; if(0 >= (ps = getpagesize())){ perror("getpagesize"); return 1; } if((char*)-1 == (buf = mmap(NULL,MS,PROT_READ|PROT_WRITE,MAP_SHARED|MAP_ANON,-1,0))){ perror("mmap"); return 1; } /* verify child and modify pages and parent will see these changes */ for(i=0;i