bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#294206: stat(1) unclear about block size


From: Jeroen van Wolffelaar
Subject: Re: Bug#294206: stat(1) unclear about block size
Date: Tue, 8 Feb 2005 17:12:34 +0100
User-agent: Mutt/1.3.28i

On Tue, Feb 08, 2005 at 03:39:05PM +0000, James Youngman wrote:
> No.    The POSIX standard (in a non-normative section) says :-
> 
> | The unit for the st_blocks member of the stat structure is not defined
> | within IEEE Std 1003.1-2001. In some implementations it is 512
> | bytes. It may differ on a file system basis. There is no correlation
> | between values of the st_blocks and st_blksize, and the f_bsize (from
> | <sys/statvfs.h>) structure members.
> | 
> | Traditionally, some implementations defined the multiplier for
> | st_blocks in <sys/param.h> as the symbol DEV_BSIZE.
> 
> I think almost all systems use 512 byte units.

I've done a bit more reading and googling, and I found statvfs(2):

         struct statvfs {
           unsigned long  f_bsize;    /* file system block size */
           unsigned long  f_frsize;   /* fragment size */
           fsblkcnt_t     f_blocks;   /* size of fs in f_frsize units */
           fsblkcnt_t     f_bfree;    /* # free blocks */
           fsblkcnt_t     f_bavail;   /* # free blocks for non-root */
(...)

and a note in statfs(2):

       LSB  has  deprecated  the library calls [f]statfs() and tells us
           to use [f]statvfs() instead.

So, since statfs seems deprecated, and statvfs more informative (it
actually carries the units in which free and total size of filesystems
is written), I think it would be useful for stat to support statvfs,
which provides a superset of the functionality of statfs(2).

Thanks,
--Jeroen

-- 
Jeroen van Wolffelaar
address@hidden (also for Jabber & MSN; ICQ: 33944357)
http://Jeroen.A-Eskwadraat.nl




reply via email to

[Prev in Thread] Current Thread [Next in Thread]