Commit bc028cdf authored by law's avatar law
Browse files

* aclocal.m4 (AC_FUNC_MMAP_ANYWHERE): Extend test to detect systems

        with MAP_ANONYMOUS and MAP_ANON.
        * configure, config.in: Rebuilt.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34977 138bc75d-0d04-0410-961f-82ee72b054a4
parent 42de8277
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>
 
* diagnostic.c (save_output_state): Remove.
......
......@@ -684,19 +684,24 @@ fi
AC_SUBST($1)dnl
])
# Check whether mmap can map an arbitrary page from /dev/zero, without
# MAP_FIXED.
# Check whether mmap can map an arbitrary page from /dev/zero or with
# MAP_ANONYMOUS, without MAP_FIXED.
AC_DEFUN([AC_FUNC_MMAP_ANYWHERE],
[AC_CHECK_HEADERS(unistd.h)
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([
/* 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 <fcntl.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. */
#ifndef HAVE_GETPAGESIZE
# ifdef HAVE_UNISTD_H
......@@ -743,12 +748,19 @@ int main()
char *x;
int fd, pg;
#ifndef MAP_ANONYMOUS
fd = open("/dev/zero", O_RDWR);
if (fd < 0)
exit(1);
#endif
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);
#endif
if (x == (char *) -1)
exit(2);
......@@ -762,7 +774,7 @@ int main()
ac_cv_func_mmap_anywhere=no)])
if test $ac_cv_func_mmap_anywhere = yes; then
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
])
......
......@@ -313,7 +313,7 @@
/* Define if printf supports %p. */
#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
/* Define if read-only mmap of a plain file works. */
......
This diff is collapsed.
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