st_blocks - was: Re: crazy swapping
Fri, 4 Dec 1998 02:41:14 +0100 (MET)

Linus reportedly wrote:

if (st.st_blocks * 512 < st.st_size) {
fprintf(stderr, "File %s appears to have holes in it");

This is interesting.
So far, the unit used in st_blocks has been undocumented.
stat(2) only warns that it may well differ from what
is given in st_blksize.
So, one gets the impression that it might depend on the
filesystem type.

Must I document the st_blocks field in a struct stat
as returned by the stat system call on an ordinary file
to be an approximation of the size measured in 512-byte blocks?


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at