about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--locale/programs/locarchive.c74
-rw-r--r--nscd/nscd_proto.h2
-rw-r--r--nss/getent.c1
-rw-r--r--sysdeps/ieee754/flt-32/s_isinf_nsf.c2
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/time.c9
6 files changed, 53 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index 5f08e63539..de8e8aa3a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 
 	* po/ja.po: Update from translation team.
 
+2011-10-08  Roland McGrath  <roland@hack.frob.com>
+
+	* locale/programs/locarchive.c (prepare_address_space): New function.
+	(create_archive, enlarge_archive, open_archive): Use it.
+
+	* sysdeps/unix/sysv/linux/x86_64/time.c: Move #include <dl-vdso.h>
+	inside [SHARED], where it is used.
+
+	* nscd/nscd_proto.h: Declare __nscd_setnetgrent.
+
+	* nss/getent.c (netgroup_keys): Remove unused variable.
+	* sysdeps/ieee754/flt-32/s_isinf_nsf.c: Likewise.
+
 2011-10-08  Ulrich Drepper  <drepper@gmail.com>
 
 	* include/math.h: Declare __isinf_ns, __isinf_nsf, __isinf_nsl.
diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c
index 770a731a61..5069265170 100644
--- a/locale/programs/locarchive.c
+++ b/locale/programs/locarchive.c
@@ -74,6 +74,29 @@ static const char *locnames[] =
 /* Size of the reserved address space area.  */
 #define RESERVE_MMAP_SIZE	512 * 1024 * 1024
 
+/* To prepare for enlargements of the mmaped area reserve some address
+   space.  On some machines, being a file mapping rather than an anonymous
+   mapping affects the address selection.  So do this mapping from the
+   actual file, even though it's only a dummy to reserve address space.  */
+static void *
+prepare_address_space (int fd, size_t total, size_t *reserved, int *xflags)
+{
+  if (total < RESERVE_MMAP_SIZE)
+    {
+      void *p = mmap64 (NULL, RESERVE_MMAP_SIZE, PROT_NONE, MAP_SHARED, fd, 0);
+      if (p != MAP_FAILED)
+        {
+          *reserved = RESERVE_MMAP_SIZE;
+          *xflags = MAP_FIXED;
+          return p;
+        }
+    }
+
+  *reserved = total;
+  *xflags = 0;
+  return NULL;
+}
+
 
 static void
 create_archive (const char *archivefname, struct locarhandle *ah)
@@ -81,7 +104,6 @@ create_archive (const char *archivefname, struct locarhandle *ah)
   int fd;
   char fname[strlen (archivefname) + sizeof (".XXXXXX")];
   struct locarhead head;
-  void *p;
   size_t total;
 
   strcpy (stpcpy (fname, archivefname), ".XXXXXX");
@@ -129,19 +151,9 @@ create_archive (const char *archivefname, struct locarhandle *ah)
       error (EXIT_FAILURE, errval, _("cannot resize archive file"));
     }
 
-  /* To prepare for enlargements of the mmaped area reserve some
-     address space.  */
-  size_t reserved = RESERVE_MMAP_SIZE;
-  int xflags = 0;
-  if (total < reserved
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
-		       -1, 0)) != MAP_FAILED))
-    xflags = MAP_FIXED;
-  else
-    {
-      p = NULL;
-      reserved = total;
-    }
+  size_t reserved;
+  int xflags;
+  void *p = prepare_address_space (fd, total, &reserved, &xflags);
 
   /* Map the header and all the administration data structures.  */
   p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
@@ -297,7 +309,6 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
   int fd;
   struct locarhead newhead;
   size_t total;
-  void *p;
   unsigned int cnt, loccnt;
   struct namehashent *oldnamehashtab;
   struct locarhandle new_ah;
@@ -390,19 +401,9 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head)
       error (EXIT_FAILURE, errval, _("cannot resize archive file"));
     }
 
-  /* To prepare for enlargements of the mmaped area reserve some
-     address space.  */
-  size_t reserved = RESERVE_MMAP_SIZE;
-  int xflags = 0;
-  if (total < reserved
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
-		       -1, 0)) != MAP_FAILED))
-    xflags = MAP_FIXED;
-  else
-    {
-      p = NULL;
-      reserved = total;
-    }
+  size_t reserved;
+  int xflags;
+  void *p = prepare_address_space (fd, total, &reserved, &xflags);
 
   /* Map the header and all the administration data structures.  */
   p = mmap64 (p, total, PROT_READ | PROT_WRITE, MAP_SHARED | xflags, fd, 0);
@@ -605,20 +606,9 @@ open_archive (struct locarhandle *ah, bool readonly)
   ah->fd = fd;
   ah->mmaped = st.st_size;
 
-  /* To prepare for enlargements of the mmaped area reserve some
-     address space.  */
-  size_t reserved = RESERVE_MMAP_SIZE;
-  int xflags = 0;
-  void *p;
-  if (st.st_size < reserved
-      && ((p = mmap64 (NULL, reserved, PROT_NONE, MAP_PRIVATE | MAP_ANON,
-		       -1, 0)) != MAP_FAILED))
-    xflags = MAP_FIXED;
-  else
-    {
-      p = NULL;
-      reserved = st.st_size;
-    }
+  size_t reserved;
+  int xflags;
+  void *p = prepare_address_space (fd, st.st_size, &reserved, &xflags);
 
   /* Map the entire file.  We might need to compare the category data
      in the file with the newly added data.  */
diff --git a/nscd/nscd_proto.h b/nscd/nscd_proto.h
index 8aa29732ef..742c154fac 100644
--- a/nscd/nscd_proto.h
+++ b/nscd/nscd_proto.h
@@ -74,5 +74,7 @@ extern int __nscd_getservbyport_r (int port, const char *proto,
 				   size_t buflen, struct servent **result);
 extern int __nscd_innetgr (const char *netgroup, const char *host,
 			   const char *user, const char *domain);
+extern int __nscd_setnetgrent (const char *group, struct __netgrent *datap);
+
 
 #endif /* _NSCD_PROTO_H */
diff --git a/nss/getent.c b/nss/getent.c
index b843433ed6..7d9422373c 100644
--- a/nss/getent.c
+++ b/nss/getent.c
@@ -472,7 +472,6 @@ static int
 netgroup_keys (int number, char *key[])
 {
   int result = 0;
-  int i;
 
   if (number == 0)
     {
diff --git a/sysdeps/ieee754/flt-32/s_isinf_nsf.c b/sysdeps/ieee754/flt-32/s_isinf_nsf.c
index bc37785168..1e46e2ce4a 100644
--- a/sysdeps/ieee754/flt-32/s_isinf_nsf.c
+++ b/sysdeps/ieee754/flt-32/s_isinf_nsf.c
@@ -14,7 +14,7 @@
 int
 __isinf_nsf (float x)
 {
-	int32_t ix,t;
+	int32_t ix;
 	GET_FLOAT_WORD(ix,x);
 	return (ix & 0x7fffffff) == 0x7f800000;
 }
diff --git a/sysdeps/unix/sysv/linux/x86_64/time.c b/sysdeps/unix/sysv/linux/x86_64/time.c
index c1c1a7526f..a613eb0f54 100644
--- a/sysdeps/unix/sysv/linux/x86_64/time.c
+++ b/sysdeps/unix/sysv/linux/x86_64/time.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001,02, 2003, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001,02,2003,2011 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -16,13 +16,11 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
+#ifdef SHARED
 #include <dl-vdso.h>
 
-
 #define VSYSCALL_ADDR_vtime	0xffffffffff600400
 
-
-#ifdef SHARED
 void *time_ifunc (void) __asm__ ("time");
 
 void *
@@ -34,7 +32,9 @@ time_ifunc (void)
   return _dl_vdso_vsym ("time", &linux26) ?: (void *) VSYSCALL_ADDR_vtime;
 }
 __asm (".type time, %gnu_indirect_function");
+
 #else
+
 # include <time.h>
 # include <sysdep.h>
 
@@ -44,6 +44,7 @@ time (time_t *t)
   INTERNAL_SYSCALL_DECL (err);
   return INTERNAL_SYSCALL (time, err, 1, t);
 }
+
 #endif
 
 strong_alias (time, __GI_time)