From owner-freebsd-stable Fri Dec 24 0:19:27 1999 Delivered-To: freebsd-stable@freebsd.org Received: from axl.noc.iafrica.com (axl.noc.iafrica.com [196.31.1.175]) by hub.freebsd.org (Postfix) with ESMTP id 636D314E49; Fri, 24 Dec 1999 00:19:18 -0800 (PST) (envelope-from sheldonh@axl.noc.iafrica.com) Received: from sheldonh (helo=axl.noc.iafrica.com) by axl.noc.iafrica.com with local-esmtp (Exim 3.11 #1) id 121PyE-000JGk-00; Fri, 24 Dec 1999 10:21:06 +0200 From: Sheldon Hearn To: Mikhail Teterin Cc: questions@FreeBSD.ORG, stable@FreeBSD.ORG Subject: Re: fstat(2) not filling st_blksize? In-reply-to: Your message of "Fri, 24 Dec 1999 00:24:25 EST." <199912240524.AAA18524@rtfm.newton> Date: Fri, 24 Dec 1999 10:21:06 +0200 Message-ID: <74073.946023666@axl.noc.iafrica.com> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 24 Dec 1999 00:24:25 EST, Mikhail Teterin wrote: > Whatever the filesystem I try (ufs, nfs, cd9660, mfs) I get the > st_blksize as zero after fstat(2)-ing the file on it. What version of FreeBSD are you using. On a 4-day-old 4.0-CURRENT, fstat(2) seems to fill st_bklsize correctly. The following sample code prints 8192 for every file I tested on my system. Ciao, Sheldon. #include #include #include #include #include int main(int argc, char *argv[]) { struct stat t; int fd; if (argc != 2) { (void)fprintf(stderr, "a single path argument is required\n"); return 1; } if ((fd = open(argv[0], O_RDONLY)) == -1) err(1, NULL); if (fstat(fd, &t) == -1) err(1, NULL); printf("%d\n", t.st_blksize); return 0; } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message