]>
git.wh0rd.org - ICEs.git/blob - test.c
4967be481aefe1556bc7a890a9ce5030b6d290d1
10 int main(int argc
, char *argv
[])
16 max
= (argc
< 2 ? sysconf(_SC_PAGE_SIZE
) : atoi(argv
[1]));
17 printf("size of file = %i\n", max
);
19 fd
= open("ppImage.config", O_WRONLY
| O_TRUNC
, 644);
20 assert(lseek(fd
, max
-1, SEEK_SET
) != -1);
21 write(fd
, argv
[0], 1);
24 fd
= open("ppImage.config", O_RDONLY
);
25 assert(fstat(fd
, &buf
) == 0);
26 max
= buf
.st_size
+ 1;
27 file
= mmap(0, max
, PROT_READ
| PROT_WRITE
, MAP_PRIVATE
, fd
, 0);
28 printf("%i\n", file
[0]);
29 printf("%i\n", file
[max
- 1]);