Subject: Using stat() to obtain a block device size on 1.6.2_STABLE
To: None <tech-kern@netbsd.org>
From: Richard Braun <syn@sceen.net>
List: tech-kern
Date: 08/12/2004 21:13:49
--pWyiEgJYm5f9v55/
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

I'm using stat() to get the size of a file. When it's a block device,
the returned size (st_size field) is 0. But sometimes it correctly
reports the size. It seems the kernel doesn't look for the size until
an I/O operation is performed on the device. Is it a bug or another
stupid standard compliance ? I tested it only on 1.6.2, but it'd be
good to check on 2.0 and current if it hasn't been corrected yet.

--=20
Richard Braun

--pWyiEgJYm5f9v55/
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)

iD8DBQFBG8FtBlWsEPLYRi8RAmwLAJ9wIOVnAVE8UlODWnkdchlLiHIl3QCfWMfH
4jP/gRcFAInStjJuCqzLhjE=
=qWpI
-----END PGP SIGNATURE-----

--pWyiEgJYm5f9v55/--