You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by je...@apache.org on 2002/04/28 09:49:34 UTC

cvs commit: apr configure.in CHANGES

jerenkrantz    02/04/28 00:49:34

  Modified:    .        configure.in CHANGES
  Log:
  Not all platforms can mmap /dev/zero, so we need to do an explicit check
  for that.  If that were to fail, then make it appear as /dev/zero never
  existed in the first place.
  
  PR: 8537
  
  Revision  Changes    Path
  1.436     +32 -1     apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.435
  retrieving revision 1.436
  diff -u -r1.435 -r1.436
  --- configure.in	24 Apr 2002 20:13:52 -0000	1.435
  +++ configure.in	28 Apr 2002 07:49:34 -0000	1.436
  @@ -591,6 +591,38 @@
   AC_CHECK_FUNCS(create_area)
   AC_CHECK_HEADERS(os2.h)
   
  +dnl Not all systems can mmap /dev/zero (such as HP-UX).  Check for that.
  +if test "$ac_cv_func_mmap" = "yes" &&
  +   test "$ac_cv_file__dev_zero" = "yes"; then
  +    AC_MSG_CHECKING(for mmap that can map /dev/zero)
  +    AC_TRY_RUN([
  +#include <sys/types.h>
  +#include <sys/stat.h>
  +#include <fcntl.h>
  +#ifdef HAVE_SYS_MMAN_H
  +#include <sys/mman.h>
  +#endif
  +    int main()
  +    {
  +        int fd;
  +        void *m;
  +        fd = open("/dev/zero", O_RDWR);
  +        if (fd < 0) {
  +            return 1;
  +        }
  +        m = mmap(0, sizeof(void*), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
  +        if (m < 0) {  /* aka MAP_FAILED */
  +            return 2;
  +        }
  +        if (munmap(m, sizeof(void*)) < 0) {
  +            return 3;
  +        }
  +        return 0;
  +    }], [], [ac_cv_file__dev_zero=no])
  +
  +    AC_MSG_RESULT($ac_cv_file__dev_zero)
  +fi
  +
   dnl Now we determine which one is our anonymous shmem preference.
   haveshmgetanon="0"
   havemmapzero="0"
  @@ -1245,7 +1277,6 @@
   echo $ac_n "${nl}Checking for Locking...${nl}"
   
   AC_CHECK_FUNCS(semget semctl flock)
  -APR_CHECK_FILE(/dev/zero)
   AC_CHECK_HEADERS(semaphore.h)
   AC_CHECK_FUNCS(sem_close sem_unlink sem_post sem_wait)
   
  
  
  
  1.268     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.267
  retrieving revision 1.268
  diff -u -r1.267 -r1.268
  --- CHANGES	25 Apr 2002 18:27:31 -0000	1.267
  +++ CHANGES	28 Apr 2002 07:49:34 -0000	1.268
  @@ -1,5 +1,8 @@
   Changes with APR b1
   
  +  *) Don't try to use /dev/zero and mmap on platforms that don't
  +     support that (such as HP-UX).  PR 8537.  [Justin Erenkrantz]
  +
     *) Reduce the number of apr_sendfile calls on AIX and OS/390 by
        remembering when the kernel tells us the next one will block.
        [Jeff Trawick]
  
  
  

Re: cvs commit: apr configure.in CHANGES

Posted by Justin Erenkrantz <je...@apache.org>.
On Wed, May 01, 2002 at 11:01:47AM -0700, Aaron Bannert wrote:
> Sorry for the late reply. Do we have a HAVE_DEV_ZERO-like define
> somewhere, and if so would this mean that an OS that had /dev/zero but
> didn't support mmap(/dev/zero) would not have that defined anymore? Other
> than that I think this is a good way to test for mmap(/dev/zero).

We don't have a HAVE_DEV_ZERO macro.  We only seem to use knowledge
of /dev/zero in configure to determine if we can do pthread mutexes.
Then, in the pthread code we assume that we have /dev/zero.  I think
shm also uses /dev/zero in a similar fashion.  -- justin

Re: cvs commit: apr configure.in CHANGES

Posted by Aaron Bannert <aa...@clove.org>.
On Sun, Apr 28, 2002 at 07:49:34AM -0000, Justin Erenkrantz wrote:
> jerenkrantz    02/04/28 00:49:34
> 
>   Modified:    .        configure.in CHANGES
>   Log:
>   Not all platforms can mmap /dev/zero, so we need to do an explicit check
>   for that.  If that were to fail, then make it appear as /dev/zero never
>   existed in the first place.
>   
>   PR: 8537

Sorry for the late reply. Do we have a HAVE_DEV_ZERO-like define
somewhere, and if so would this mean that an OS that had /dev/zero but
didn't support mmap(/dev/zero) would not have that defined anymore? Other
than that I think this is a good way to test for mmap(/dev/zero).

-aaron

Re: cvs commit: apr configure.in CHANGES

Posted by Justin Erenkrantz <je...@apache.org>.
On Sun, Apr 28, 2002 at 07:49:34AM -0000, jerenkrantz@apache.org wrote:
> jerenkrantz    02/04/28 00:49:34
> 
>   Modified:    .        configure.in CHANGES
>   Log:
>   Not all platforms can mmap /dev/zero, so we need to do an explicit check
>   for that.  If that were to fail, then make it appear as /dev/zero never
>   existed in the first place.
>   
>   PR: 8537

Can we make sure this change does NOT get into 2.0.36?  (Don't think
it should, but if Sander retags .36 from HEAD...)

I'm worried that this may return a false negative in some
circumstances on platforms I don't have access to (it correctly
passes on Linux), so I'd like this to get the benefit of a complete
development cycle.

I've pointed the person who filed the PR to CVS.  -- justin