about summary refs log tree commit diff
path: root/locale/loadlocale.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-08-03 16:47:01 +0000
committerUlrich Drepper <drepper@redhat.com>1998-08-03 16:47:01 +0000
commit7cabd57c0d64a2ee5ca0c5218c877ff700727880 (patch)
tree4db8d28a07bfb0ee5705e9199fcf1f59d5b27403 /locale/loadlocale.c
parent2698e32c2c2fae23c5c5f39f73b09553158b482d (diff)
downloadglibc-7cabd57c0d64a2ee5ca0c5218c877ff700727880.tar.gz
glibc-7cabd57c0d64a2ee5ca0c5218c877ff700727880.tar.xz
glibc-7cabd57c0d64a2ee5ca0c5218c877ff700727880.zip
Update.
1998-08-03 16:36  Ulrich Drepper  <drepper@cygnus.com>

	* catgets/catgets.c: Use mmap/munmap only is _POSIX_MAPPED_FILES
	is defined.
	* catgets/open_catalog.c: Likewise.
	* iconv/iconv_prog.c: Likewise.
	* intl/loadmsgcat.c: Likewise.
	* locale/findlocale.c: Likewise.
	* locale/loadlocale.c: Likewise.
	* locale/programs/localedef.c: Likewise.
	* malloc/malloc.c: Likewise.

	* elf/elf.h: Fix typo.

	* math/Makefile: Use $(LN_S) instead of ln.

	* sysdeps/generic/getpgid.c: Fix return type.

1998-08-01 02:49 -0400  Zack Weinberg  <zack@rabi.phys.columbia.edu>

	* sysdeps/posix/tempname.c (__stdio_gen_tempname): Rename to
	__gen_tempname and simplify the interface.  Strip out the
	code to do path search and create FILE objects.  This function
	now takes a mktemp() style template and returns either a name
	or a file descriptor.
	(__path_search): New function; searches for directories for
	temp files.
	* sysdeps/generic/tempname.c: Stub out __gen_tempname and
	__path_search, not __stdio_gen_tempname.

	* libio/stdio.h: Prototype __gen_tempname and __path_search,
	not __stdio_gen_tempname.
	* stdio/stdio.h: Likewise.

	* stdio-common/tempnam.c: Use __path_search and __gen_tempname.
	* stdio-common/tmpfile.c: Likewise.
	* stdio-common/tmpfile64.c: Likewise.
	* stdio-common/tmpnam.c: Likewise.
	* stdio-common/tmpnam_r.c: Likewise.

	* misc/mkstemp.c: New file.  Use __gen_tempname.
	* misc/mktemp.c: Likewise.

	* sysdeps/posix/mkstemp.c: Removed.
	* sysdeps/posix/mktemp.c: Removed.
	* sysdeps/generic/mkstemp.c: Removed.
	* sysdeps/generic/mktemp.c: Removed.

1998-08-02  Thorsten Kukuk  <kukuk@vt.uni-paderborn.de>

	* configure.in: Check, if door add-on is installed.
	* config.make.in: Add have_doors.
	* sunrpc/Makefile: Add HAVE_DOOR define.
	* sunrpc/key_call.c: Add keyserv/door interface.

	* sunrpc/svc_unix.c: Call setsockopt only if SO_PASSCRED is defined.
	* sunrpc/clnt_unix.c: Likewise.

1998-08-02  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* inet/netinet/in.h (IN_CLASSC): Correct mask.
	Reported by Ian Staniforth <I.Staniforth@sheffield.ac.uk> [fixes
	PR libc/727].

1998-08-03 10:23  Ulrich Drepper  <drepper@cygnus.com>

	* misc/Makefile: Fix installation problem with --disable-shared.
	* posix/Makefile: Likewise.

1998-08-02  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* posix/regex.c (re_search_2): Optimize searching for anchored
	pattern if '^' cannot match at embedded newlines.
	(regerror): Renamed from __regerror, which it should only be
	called if _LIBC.

1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sunrpc/svc_unix.c (__msgread): Check setsockopt return value.

1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/glob.c: Remove obsolete cast.

1998-07-31  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Rules (tests): Fix last change.
Diffstat (limited to 'locale/loadlocale.c')
-rw-r--r--locale/loadlocale.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/locale/loadlocale.c b/locale/loadlocale.c
index d856063d52..8649abb241 100644
--- a/locale/loadlocale.c
+++ b/locale/loadlocale.c
@@ -23,7 +23,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <sys/mman.h>
+#ifdef _POSIX_MAPPED_FILES
+# include <sys/mman.h>
+#endif
 #include <sys/stat.h>
 
 #include "localeinfo.h"
@@ -113,24 +115,32 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 
   /* Map in the file's data.  */
   save_err = errno;
-#ifndef MAP_COPY
+#ifdef _POSIX_MAPPED_FILES
+# ifndef MAP_COPY
   /* Linux seems to lack read-only copy-on-write.  */
-#define MAP_COPY MAP_PRIVATE
-#endif
-#ifndef	MAP_FILE
+#  define MAP_COPY MAP_PRIVATE
+# endif
+# ifndef MAP_FILE
   /* Some systems do not have this flag; it is superfluous.  */
-#define	MAP_FILE 0
-#endif
-#ifndef MAP_INHERIT
+#  define MAP_FILE 0
+# endif
+# ifndef MAP_INHERIT
   /* Some systems might lack this; they lose.  */
-#define MAP_INHERIT 0
-#endif
+#  define MAP_INHERIT 0
+# endif
   filedata = (void *) __mmap ((caddr_t) 0, st.st_size, PROT_READ,
 			      MAP_FILE|MAP_COPY|MAP_INHERIT, fd, 0);
-  if ((void *) filedata == MAP_FAILED)
+  if ((void *) filedata != MAP_FAILED)
+    {
+      if (st.st_size < sizeof (*filedata))
+	/* This cannot be a locale data file since it's too small.  */
+	goto puntfd;
+    }
+  else
     {
       if (errno == ENOSYS)
 	{
+#endif	/* _POSIX_MAPPED_FILES */
 	  /* No mmap; allocate a buffer and read from the file.  */
 	  mmaped = 0;
 	  filedata = malloc (st.st_size);
@@ -156,13 +166,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 	  else
 	    goto puntfd;
 	  __set_errno (save_err);
+#ifdef _POSIX_MAPPED_FILES
 	}
       else
 	goto puntfd;
     }
-  else if (st.st_size < sizeof (*filedata))
-    /* This cannot be a locale data file since it's too small.  */
-    goto puntfd;
+#endif	/* _POSIX_MAPPED_FILES */
 
   if (filedata->magic == LIMAGIC (category))
     /* Good data file in our byte order.  */
@@ -175,7 +184,12 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 	/* Bad data file in either byte order.  */
 	{
 	puntmap:
-	  __munmap ((caddr_t) filedata, st.st_size);
+#ifdef _POSIX_MAPPED_FILES
+	  if (mmaped)
+	    __munmap ((caddr_t) filedata, st.st_size);
+	  else
+#endif	/* _POSIX_MAPPED_FILES */
+	    free (filedata);
 	puntfd:
 	  __close (fd);
 	  return;
@@ -228,9 +242,11 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
 void
 _nl_unload_locale (struct locale_data *locale)
 {
+#ifdef _POSIX_MAPPED_FILES
   if (locale->mmaped)
     __munmap ((caddr_t) locale->filedata, locale->filesize);
   else
+#endif
     free ((void *) locale->filedata);
 
   free (locale);