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: Michael Stone
Subject: Re: Bug#294206: stat(1) unclear about block size
Date: Tue, 8 Feb 2005 11:22:24 -0500
User-agent: Mutt/1.5.6+20040907i

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.

Note where it says "some implementations"? You're diving heavily into
implementation-specific logic, and making unfounded assumptions. The
part where it says "There is no correlation between values of the
st_blocks and st_blksize, and the f_bsize" goes with "The unit for the
st_blocks member of the stat structure is not defined within IEEE Std
1003.1-2001". IOW, POSIX doesn't define any such relationship. A
particular implementation *may* define such a relationship (and linux
has). On other platforms the st_blocks unit could be constant and the
st_blksize might actually be a suggestion to applications as to what the
most efficient I/O size is (e.g., the size of a disk stripe).

Mike Stone





reply via email to

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