apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sander Striker" <stri...@apache.org>
Subject RE: mmap bug?
Date Thu, 06 Mar 2003 09:24:39 GMT
> From: Cliff Woolley [mailto:jwoolley@virginia.edu]
> Sent: Friday, February 28, 2003 4:41 PM

> On Fri, 28 Feb 2003, Sander Striker wrote:
> 
> > Can someone at home in the file buckets take a look at these:
> >
> > buckets/apr_buckets_file.c:93:        if (apr_mmap_create(&mm, a->fd, fileoffset,
APR_MMAP_LIMIT,
> > buckets/apr_buckets_file.c:102:             (apr_mmap_create(&mm, a->fd,
fileoffset, filelength,
> >
> > And see if 0 length files are handled correctly?
> 
> I suspect they're not, but I'll have to check.

I think they are.  There is no mmaping taking place when filelength < APR_MMAP_THRESHOLD,
which is at least 1:

/** @def APR_MMAP_THRESHOLD
 * Files have to be at least this big before they're mmap()d.  This is to deal
 * with systems where the expense of doing an mmap() and an munmap() outweighs
 * the benefit for small files.  It shouldn't be set lower than 1.
 */


> I suppose the best solution would be to go ahead and try to mmap the file; if you get
an
> error, see if it's einval and you passed mmap a zero length file.  if so,
> morph yourself to a zero-length immortal bucket.  that way we don't pay
> the cost of *three* error tests in the main-line case, only two.

I guess it won't be needed.

Sander


Mime
View raw message