i was playing around with creating files with holes in them:
% ls -l holy_file
-rw------- 1 p p 10000003 Nov 17 19:59 holy_file
% du -k holy_file
24 holy_file
the program i wrote to generate this file looks more or less like:
if((fd = open("holy_file", O_WRONLY|O_CREAT)) < 0)
exit(0);
write(fd, string1, strlen(string1));
lseek(fd, 99999, SEEK_SET);
write(fd, string2, strlen(string2));
ls gets its info from stat. i did an strace on du, and it also calls stat.
i'm curious about the discrepency in file size. does anyone know why the
two programs report different file sizes?
pete