The following reply was made to PR general/1491; it has been noted by GNATS.

From: Dean Gaudet <[EMAIL PROTECTED]>
To: Jonathan Roy <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
Subject: Re: general/1491: mmap_handler error_log entry for 0 length files
Date: Fri, 28 Nov 1997 11:23:11 -0800 (PST)

 Oh damn.  Ok here's a patch that fixes this and the other mmap_handler
 error_log entries for 1.3b3.  It's against 1.3b3. 
 
 Thanks
 Dean
 
 Index: http_core.c
 ===================================================================
 RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
 retrieving revision 1.140
 diff -u -r1.140 http_core.c
 --- http_core.c        1997/11/15 00:16:50     1.140
 +++ http_core.c        1997/11/28 19:17:47
 @@ -75,15 +75,15 @@
   * <http://www.isi.edu/~johnh/SOFTWARE/APACHE/index.html>.
   */
  
 -/* 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.
 +/* 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.
   */
  #ifndef MMAP_THRESHOLD
  #ifdef SUNOS4
  #define MMAP_THRESHOLD                (8*1024)
  #else
 -#define MMAP_THRESHOLD                0
 +#define MMAP_THRESHOLD                1
  #endif
  #endif
  #endif
 @@ -1864,21 +1864,20 @@
      block_alarms();
      if ((r->finfo.st_size >= MMAP_THRESHOLD)
        && ( !r->header_only || (d->content_md5 & 1))) {
 -      /* we need to protect ourselves in case we die while we've got the
 +      /* we need to protect ourselves in case we die while we've got the
         * file mmapped */
        mm = mmap (NULL, r->finfo.st_size, PROT_READ, MAP_PRIVATE,
                    fileno(f), 0);
 +      if (mm == (caddr_t)-1) {
 +          aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
 +                      "default_handler: mmap failed: %s", r->filename);
 +      }
      } else {
        mm = (caddr_t)-1;
      }
  
      if (mm == (caddr_t)-1) {
        unblock_alarms();
 -
 -      if (r->finfo.st_size >= MMAP_THRESHOLD) {
 -          aplog_error(APLOG_MARK, APLOG_CRIT, r->server,
 -                      "mmap_handler: mmap failed: %s", r->filename);
 -      }
  #endif
  
        if (d->content_md5 & 1) {
 
 

Reply via email to