You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Dean Gaudet <dg...@arctic.org> on 1997/11/28 20:24:19 UTC

[PATCH] Re: general/1491: mmap_handler error_log entry for 0 length files

One more iteration trying to get the mmap code just right ... don't try to
mmap zero length files. 

Dean

Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
retrieving revision 1.141
diff -u -r1.141 http_core.c
--- http_core.c	1997/11/22 01:59:57	1.141
+++ http_core.c	1997/11/28 19:19:21
@@ -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


Re: [PATCH] Re: general/1491: mmap_handler error_log entry for 0 length files

Posted by Dean Gaudet <dg...@arctic.org>.

On Fri, 28 Nov 1997, Marc Slemko wrote:

> On Fri, 28 Nov 1997, Dean Gaudet wrote:
> 
> > One more iteration trying to get the mmap code just right ... don't try to
> > mmap zero length files. 
> 
> Does this fail on some systems?  Works fine on FreeBSD.

>From Solaris' "man mmap":

ERRORS
...
     EINVAL     The argument len has a value less than  or  equal
                to 0.

And it's certainly not required by the single unix spec... they talk a lot
about [pa, pa + len), which isn't a valid range if len is 0.

> You sure the submitter of the PR isn't just seeing the bogus logging that
> is in 1.3b3 in the first place, ie. it has nothing to do with zero length?

Yep I'm sure.

Dean


Re: [PATCH] Re: general/1491: mmap_handler error_log entry for 0 length files

Posted by Marc Slemko <ma...@worldgate.com>.
On Fri, 28 Nov 1997, Dean Gaudet wrote:

> One more iteration trying to get the mmap code just right ... don't try to
> mmap zero length files. 

Does this fail on some systems?  Works fine on FreeBSD.

You sure the submitter of the PR isn't just seeing the bogus logging that
is in 1.3b3 in the first place, ie. it has nothing to do with zero length?

> 
> Dean
> 
> Index: http_core.c
> ===================================================================
> RCS file: /export/home/cvs/apachen/src/main/http_core.c,v
> retrieving revision 1.141
> diff -u -r1.141 http_core.c
> --- http_core.c	1997/11/22 01:59:57	1.141
> +++ http_core.c	1997/11/28 19:19:21
> @@ -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
>