Previous: Running self-tests under valgrind, Up: Particular Modules

13.20 stat-size

The stat-size module provides a small number of macros intended for interpreting the file size information in an instance of struct stat.

On POSIX systems, the st_blocks member of struct stat contains the number of disk blocks occupied by a file. The ST_NBLOCKS macro is used to estimate this quantity on systems which don't actually have st_blocks. Each of these blocks contains ST_NBLOCKSIZE bytes.

The value of ST_NBLOCKSIZE is often quite small, small enough that performing I/O in chunks that size would be inefficient. ST_BLKSIZE is the I/O block size recommended for I/O to this file. This is not guaranteed to give optimum performance, but it should be reasonably efficient.