From owner-freebsd-stable Mon Nov 22 20:21: 3 1999 Delivered-To: freebsd-stable@freebsd.org Received: from mail.uni-bielefeld.de (mail.uni-bielefeld.de [129.70.4.90]) by hub.freebsd.org (Postfix) with ESMTP id 1728F14C2F; Mon, 22 Nov 1999 20:20:57 -0800 (PST) (envelope-from bfischer@Techfak.uni-bielefeld.de) Received: from frolic.no-support.loc (ppp36-366.hrz.uni-bielefeld.de) by mail.uni-bielefeld.de (Sun Internet Mail Server sims.3.5.1999.05.24.18.28.p7) with ESMTP id <0FLM007KGUQ1HP@mail.uni-bielefeld.de>; Tue, 23 Nov 1999 05:20:26 +0100 (MET) Received: (from bjoern@localhost) by frolic.no-support.loc (8.9.3/8.9.3) id FAA01326; Tue, 23 Nov 1999 05:20:09 +0100 (CET envelope-from bjoern) Date: Tue, 23 Nov 1999 05:20:09 +0100 From: Bjoern Fischer Subject: stat(2) weirdness To: freebsd-hackers@FreeBSD.ORG, freebsd-stable@FreeBSD.ORG Message-id: <19991123051328.A292@frolic.no-support.loc> MIME-version: 1.0 X-Mailer: Mutt 1.0i X-Mailer: Mutt 1.0i Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello, recently while debugging a problem in wwwoffle-2.5b I realized, that stat(2) behaves at least extremely strange on 3.3-STABLE: This small example... #include #include #include int main(int argc, char *argv[]) { char *fname =3D argv[0]; struct stat sb; int res =3D stat(argv[0], &sb); printf("filename : %s\n" \ "st_size : %d\n" \ "st_blocks : %d\n" \ "st_blksize : %d\n", fname, sb.st_size, sb.st_blocks, sb.st_blksize); return res; } would emerge this when run: filename : ./a.out st_size : 3342 st_blocks : 0 st_blksize : 8 Any idea why st_blocks is always zero? This can't be correct. st_blksize seems to be the number of blocks allocated for filename, although assuming a blocksize of 512 the object would fit into 7 blocks. Maybe that's the result of the underlying FFS's fsize (1024). Bj=F6rn --=20 -----BEGIN GEEK CODE BLOCK----- GCS d--(+) s++: a- C+++(-) UB++++OSI++++$ P+++(-) L---(++) !E W- N+ o>+ K- !w !O !M !V PS++ PE- PGP++ t+++ !5 X++ tv- b+++ D++ G e+ h-- y+=20 ------END GEEK CODE BLOCK------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message