19 main(
int argc,
char * argv[])
27 print_buf[100] =
'\0';
29 int fd = open(
"./mmapfiletest.c", O_RDONLY);
32 map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
35 position = random() % (st.st_size - 100);
37 for (i=0; i<100; i+=10) {
38 print_buf[i+0] = map[position + i + 0];
39 print_buf[i+1] = map[position + i + 1];
40 print_buf[i+2] = map[position + i + 2];
41 print_buf[i+3] = map[position + i + 3];
42 print_buf[i+4] = map[position + i + 4];
43 print_buf[i+5] = map[position + i + 5];
44 print_buf[i+6] = map[position + i + 6];
45 print_buf[i+7] = map[position + i + 7];
46 print_buf[i+8] = map[position + i + 8];
47 print_buf[i+9] = map[position + i + 9];
int main(int argc, char *argv[])