00001 /* Maps and unmaps a file and verifies that the mapped region is 00002 inaccessible afterward. */ 00003 00004 #include <syscall.h> 00005 #include "tests/vm/sample.inc" 00006 #include "tests/lib.h" 00007 #include "tests/main.h" 00008 00009 #define ACTUAL ((void *) 0x10000000) 00010 00011 void 00012 test_main (void) 00013 { 00014 int handle; 00015 mapid_t map; 00016 00017 CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); 00018 CHECK ((map = mmap (handle, ACTUAL)) != MAP_FAILED, "mmap \"sample.txt\""); 00019 00020 munmap (map); 00021 00022 fail ("unmapped memory is readable (%d)", *(int *) ACTUAL); 00023 }