From owner-freebsd-hackers Sun Oct 26 22:50:50 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id WAA19714 for hackers-outgoing; Sun, 26 Oct 1997 22:50:50 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id WAA19709 for ; Sun, 26 Oct 1997 22:50:46 -0800 (PST) (envelope-from j@uriah.heep.sax.de) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id HAA00370 for hackers@FreeBSD.ORG; Mon, 27 Oct 1997 07:50:44 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id HAA27274; Mon, 27 Oct 1997 07:50:09 +0100 (MET) Message-ID: <19971027075008.JD23477@uriah.heep.sax.de> Date: Mon, 27 Oct 1997 07:50:08 +0100 From: j@uriah.heep.sax.de (J Wunsch) To: hackers@FreeBSD.ORG Subject: Re: help with fstat? References: <199710270258.TAA02224@meowy.angio.net> X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199710270258.TAA02224@meowy.angio.net>; from Dave Andersen on Oct 26, 1997 19:58:46 -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk As Dave Andersen wrote: > > isn't fstat supposed to be what i'm looking for? > > Fstat will give you the size of the file, yes. You'll want to use > it in conjunction with mmap. But that's st_size, of course, not st_blocks, Alfred. st_blocks (IMHO) also accounts for indirect blocks, and unless your file is a multiple of the blocksize, will make you attempt reading beyond the end of the file (which you should never do for mmapped files). -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)