Skip site navigation (1)Skip section navigation (2)
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?
Message-ID:  <19971027075008.JD23477@uriah.heep.sax.de>
In-Reply-To: <199710270258.TAA02224@meowy.angio.net>; from Dave Andersen on Oct 26, 1997 19:58:46 -0700
References:  <Pine.BSF.3.96.971026212719.19711B-100000@server.local.sunyit.edu> <199710270258.TAA02224@meowy.angio.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971027075008.JD23477>