fd = open(argv[1], O_RDONLY); if (fd < 0) { perror(argv[1]); exit(1); } mapstart = (long *)mmap((void *)0, len, PROT_READ, MAP_PRIVATE, fd, offset & ~MAP_MASK); if ((long)mapstart < 0) { perror("mapstart failed"); exit(1); } close(fd); printf("Test values before second mmap:\n"); testMap(mapstart); fd2 = open(argv[2], O_RDONLY); if (fd < 0) { perror(argv[2]); exit(1); } mapstart2 = (long *)mmap((void *)0, len, PROT_READ, MAP_PRIVATE, fd2, offset & ~MAP_MASK); if ((long)mapstart2 < 0) { perror("mapstart2 failed"); exit(1); } close(fd2); printf("Test values before second mmap:\n"); testMap(mapstart); printf("Did the contents of the second mmap overwrite?\n"); testMap(mapstart2);