#include #include #include #include #include #include #include struct list { char data[500]; off_t next; }; int main(int argc, char *argv[argc+1]) { size_t len = 100 << 20; int fd = open(argv[1], O_RDONLY); if (fd == -1) { perror("open"); return EXIT_FAILURE; } void *base = mmap(NULL, len, PROT_READ, MAP_PRIVATE, fd, 0); if (base == MAP_FAILED) { perror("mmap"); return EXIT_FAILURE; } struct list *item = base; while (item->next) { printf("%s\n", item->data); printf("next is %p\n", item->next); item = base + item->next; } printf("LAST %s\n", item->data); }