Commit 4c1331d6 by J. David Anglin Committed by Jeff Law

aclocal.m4 (AC_FUNC_MMAP_ANYWHERE): Extend test to detect systems with MAP_ANONYMOUS and MAP_ANON.

        * aclocal.m4 (AC_FUNC_MMAP_ANYWHERE): Extend test to detect systems
        with MAP_ANONYMOUS and MAP_ANON.
        * configure, config.in: Rebuilt.

From-SVN: r34977
parent c7a136d3
2000-07-11 J. David Anglin <dave@hiauly1.hia.nrc.ca>
* aclocal.m4 (AC_FUNC_MMAP_ANYWHERE): Extend test to detect systems
with MAP_ANONYMOUS and MAP_ANON.
* configure, config.in: Rebuilt.
2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com> 2000-07-12 Gabriel Dos Reis <gdr@codesourcery.com>
* diagnostic.c (save_output_state): Remove. * diagnostic.c (save_output_state): Remove.
......
...@@ -684,19 +684,24 @@ fi ...@@ -684,19 +684,24 @@ fi
AC_SUBST($1)dnl AC_SUBST($1)dnl
]) ])
# Check whether mmap can map an arbitrary page from /dev/zero, without # Check whether mmap can map an arbitrary page from /dev/zero or with
# MAP_FIXED. # MAP_ANONYMOUS, without MAP_FIXED.
AC_DEFUN([AC_FUNC_MMAP_ANYWHERE], AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
[AC_CHECK_HEADERS(unistd.h) [AC_CHECK_HEADERS(unistd.h)
AC_CHECK_FUNCS(getpagesize) AC_CHECK_FUNCS(getpagesize)
AC_CACHE_CHECK(for working mmap from /dev/zero, ac_cv_func_mmap_anywhere, AC_CACHE_CHECK(for working mmap which provides zeroed pages anywhere,
ac_cv_func_mmap_anywhere,
[AC_TRY_RUN([ [AC_TRY_RUN([
/* Test by Richard Henderson and Alexandre Oliva. /* Test by Richard Henderson and Alexandre Oliva.
Check whether mmap from /dev/zero works. */ Check whether mmap MAP_ANONYMOUS or mmap from /dev/zero works. */
#include <sys/types.h> #include <sys/types.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
#endif
/* This mess was copied from the GNU getpagesize.h. */ /* This mess was copied from the GNU getpagesize.h. */
#ifndef HAVE_GETPAGESIZE #ifndef HAVE_GETPAGESIZE
# ifdef HAVE_UNISTD_H # ifdef HAVE_UNISTD_H
...@@ -743,12 +748,19 @@ int main() ...@@ -743,12 +748,19 @@ int main()
char *x; char *x;
int fd, pg; int fd, pg;
#ifndef MAP_ANONYMOUS
fd = open("/dev/zero", O_RDWR); fd = open("/dev/zero", O_RDWR);
if (fd < 0) if (fd < 0)
exit(1); exit(1);
#endif
pg = getpagesize(); pg = getpagesize();
#ifdef MAP_ANONYMOUS
x = (char*)mmap(0, pg, PROT_READ|PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#else
x = (char*)mmap(0, pg, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0); x = (char*)mmap(0, pg, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
#endif
if (x == (char *) -1) if (x == (char *) -1)
exit(2); exit(2);
...@@ -762,7 +774,7 @@ int main() ...@@ -762,7 +774,7 @@ int main()
ac_cv_func_mmap_anywhere=no)]) ac_cv_func_mmap_anywhere=no)])
if test $ac_cv_func_mmap_anywhere = yes; then if test $ac_cv_func_mmap_anywhere = yes; then
AC_DEFINE(HAVE_MMAP_ANYWHERE, 1, AC_DEFINE(HAVE_MMAP_ANYWHERE, 1,
[Define if mmap can get us zeroed pages from /dev/zero.]) [Define if mmap can get us zeroed pages without MAP_FIXED.])
fi fi
]) ])
......
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
/* Define if printf supports %p. */ /* Define if printf supports %p. */
#undef HAVE_PRINTF_PTR #undef HAVE_PRINTF_PTR
/* Define if mmap can get us zeroed pages from /dev/zero. */ /* Define if mmap can get us zeroed pages without MAP_FIXED. */
#undef HAVE_MMAP_ANYWHERE #undef HAVE_MMAP_ANYWHERE
/* Define if read-only mmap of a plain file works. */ /* Define if read-only mmap of a plain file works. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment