aclocal.m4 (AM_GNU_GETTEXT): Don't AC_REQUIRE([AC_FUNC_MMAP]).
* aclocal.m4 (AM_GNU_GETTEXT): Don't AC_REQUIRE([AC_FUNC_MMAP]). (AC_FUNC_MMAP_FILE): New macro, tests read-only private map of a plain file. * configure.in: Call AC_FUNC_MMAP_FILE. * configure: Regenerate. * config.in: Regenerate. * intl/loadmsgcat.c: Test HAVE_MMAP_FILE not HAVE_MMAP. * fixinc/fixincl.c: Likewise. From-SVN: r33212
This commit is contained in:
parent
994a57cd28
commit
56f02b88c1
|
@ -1,3 +1,15 @@
|
|||
2000-04-17 Zack Weinberg <zack@wolery.cumb.org>
|
||||
|
||||
* aclocal.m4 (AM_GNU_GETTEXT): Don't AC_REQUIRE([AC_FUNC_MMAP]).
|
||||
(AC_FUNC_MMAP_FILE): New macro, tests read-only private map of
|
||||
a plain file.
|
||||
* configure.in: Call AC_FUNC_MMAP_FILE.
|
||||
* configure: Regenerate.
|
||||
* config.in: Regenerate.
|
||||
|
||||
* intl/loadmsgcat.c: Test HAVE_MMAP_FILE not HAVE_MMAP.
|
||||
* fixinc/fixincl.c: Likewise.
|
||||
|
||||
2000-04-17 Richard Henderson <rth@cygnus.com>
|
||||
|
||||
* builtins.c (expand_builtin_expect): New.
|
||||
|
|
|
@ -503,7 +503,6 @@ AC_DEFUN(AM_GNU_GETTEXT,
|
|||
AC_REQUIRE([AC_TYPE_OFF_T])dnl
|
||||
AC_REQUIRE([AC_TYPE_SIZE_T])dnl
|
||||
AC_REQUIRE([AC_FUNC_ALLOCA])dnl
|
||||
AC_REQUIRE([AC_FUNC_MMAP])dnl
|
||||
|
||||
AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \
|
||||
unistd.h sys/param.h])
|
||||
|
@ -762,3 +761,55 @@ if test $ac_cv_func_mmap_anywhere = yes; then
|
|||
[Define if mmap can get us zeroed pages from /dev/zero.])
|
||||
fi
|
||||
])
|
||||
|
||||
# Check whether mmap can map a plain file, without MAP_FIXED.
|
||||
AC_DEFUN([AC_FUNC_MMAP_FILE],
|
||||
[AC_REQUIRE([AC_FUNC_MMAP_ANYWHERE])dnl
|
||||
AC_CACHE_CHECK(for working mmap of a file, ac_cv_func_mmap_file,
|
||||
[# Create a file one thousand bytes long.
|
||||
for i in 1 2 3 4 5 6 7 8 9 0
|
||||
do for j in 1 2 3 4 5 6 7 8 9 0
|
||||
do echo $i $j xxxxx
|
||||
done
|
||||
done > conftestdata$$
|
||||
|
||||
AC_TRY_RUN([
|
||||
/* Test by Zack Weinberg. Modified from MMAP_ANYWHERE test by
|
||||
Richard Henderson and Alexandre Oliva.
|
||||
Check whether read-only mmap of a plain file works. */
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
char *x;
|
||||
int fd;
|
||||
struct stat st;
|
||||
|
||||
fd = open("conftestdata$$", O_RDONLY);
|
||||
if (fd < 0)
|
||||
exit(1);
|
||||
|
||||
if (fstat (fd, &st))
|
||||
exit(2);
|
||||
|
||||
x = (char*)mmap(0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
if (x == (char *) -1)
|
||||
exit(3);
|
||||
|
||||
if (x[0] != '1' || x[1] != ' ' || x[2] != '1' || x[3] != ' ')
|
||||
exit(4);
|
||||
|
||||
if (munmap(x, st.st_size) < 0)
|
||||
exit(5);
|
||||
|
||||
exit(0);
|
||||
}], ac_cv_func_mmap_file=yes, ac_cv_func_mmap_file=no,
|
||||
ac_cv_func_mmap_file=no)])
|
||||
if test $ac_cv_func_mmap_file = yes; then
|
||||
AC_DEFINE(HAVE_MMAP_FILE, 1,
|
||||
[Define if read-only mmap of a plain file works.])
|
||||
fi
|
||||
])
|
||||
|
|
|
@ -203,9 +203,6 @@
|
|||
/* Define if the `long double' type works. */
|
||||
#undef HAVE_LONG_DOUBLE
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define if you have the ANSI # stringizing operator in cpp. */
|
||||
#undef HAVE_STRINGIZE
|
||||
|
||||
|
@ -425,3 +422,6 @@
|
|||
/* Define if mmap can get us zeroed pages from /dev/zero. */
|
||||
#undef HAVE_MMAP_ANYWHERE
|
||||
|
||||
/* Define if read-only mmap of a plain file works. */
|
||||
#undef HAVE_MMAP_FILE
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -398,6 +398,7 @@ case "${host}" in
|
|||
esac
|
||||
AC_FUNC_VFORK
|
||||
AC_FUNC_MMAP_ANYWHERE
|
||||
AC_FUNC_MMAP_FILE
|
||||
|
||||
GCC_NEED_DECLARATIONS(bcopy bzero bcmp \
|
||||
index rindex getenv atol sbrk abort atof getcwd getwd \
|
||||
|
|
|
@ -24,7 +24,7 @@ Boston, MA 02111-1307, USA. */
|
|||
|
||||
#include "fixlib.h"
|
||||
|
||||
#if HAVE_MMAP
|
||||
#if HAVE_MMAP_FILE
|
||||
#include <sys/mman.h>
|
||||
#define BAD_ADDR ((void*)-1)
|
||||
#endif
|
||||
|
@ -136,7 +136,7 @@ int fixed_ct = 0;
|
|||
int altered_ct = 0;
|
||||
#endif /* DO_STATS */
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#ifdef HAVE_MMAP_FILE
|
||||
#define UNLOAD_DATA() do { if (curr_data_mapped) { \
|
||||
munmap ((void*)pz_curr_data, data_map_size); close (data_map_fd); } \
|
||||
else free ((void*)pz_curr_data); } while(0)
|
||||
|
@ -510,7 +510,7 @@ load_file ( fname )
|
|||
return (char*)NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_MMAP
|
||||
#ifdef HAVE_MMAP_FILE
|
||||
curr_data_mapped = BOOL_TRUE;
|
||||
res = (char*)mmap ((void*)NULL, data_map_size, PROT_READ, MAP_PRIVATE,
|
||||
data_map_fd, 0);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP) || defined _LIBC
|
||||
#if defined HAVE_MMAP_FILE || defined _LIBC
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
|
@ -68,7 +68,7 @@ _nl_load_domain (domain_file)
|
|||
size_t size;
|
||||
struct stat st;
|
||||
struct mo_file_header *data = (struct mo_file_header *) -1;
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
#if (defined HAVE_MMAP_FILE && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
int use_mmap = 0;
|
||||
#endif
|
||||
|
@ -99,7 +99,7 @@ _nl_load_domain (domain_file)
|
|||
return;
|
||||
}
|
||||
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
#if (defined HAVE_MMAP_FILE && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
/* Now we are ready to load the file. If mmap() is available we try
|
||||
this first. If not available or it failed we try to load it. */
|
||||
|
@ -149,7 +149,7 @@ _nl_load_domain (domain_file)
|
|||
if (data->magic != _MAGIC && data->magic != _MAGIC_SWAPPED)
|
||||
{
|
||||
/* The magic number is wrong: not a message catalog file. */
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
#if (defined HAVE_MMAP_FILE && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
if (use_mmap)
|
||||
munmap ((caddr_t) data, size);
|
||||
|
@ -166,7 +166,7 @@ _nl_load_domain (domain_file)
|
|||
|
||||
domain = (struct loaded_domain *) domain_file->data;
|
||||
domain->data = (char *) data;
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
#if (defined HAVE_MMAP_FILE && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
domain->use_mmap = use_mmap;
|
||||
#endif
|
||||
|
@ -188,7 +188,7 @@ _nl_load_domain (domain_file)
|
|||
break;
|
||||
default:
|
||||
/* This is an illegal revision. */
|
||||
#if (defined HAVE_MMAP && defined HAVE_MUNMAP && !defined DISALLOW_MMAP) \
|
||||
#if (defined HAVE_MMAP_FILE && !defined DISALLOW_MMAP) \
|
||||
|| defined _LIBC
|
||||
if (use_mmap)
|
||||
munmap ((caddr_t) data, size);
|
||||
|
|
Loading…
Reference in New Issue