[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r10098 - in /fsf/trunk/libc: ./ elf/ include/ locale/programs/ localedata/ localedata/locales/ nptl/ posix/ string/ sysdeps/...



Author: eglibc
Date: Thu Mar 25 00:03:15 2010
New Revision: 10098

Log:
Import glibc-mainline for 2010-03-25

Added:
    fsf/trunk/libc/posix/bug-glob3.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/elf/dl-deps.c
    fsf/trunk/libc/elf/dl-lookup.c
    fsf/trunk/libc/include/link.h
    fsf/trunk/libc/include/unistd.h
    fsf/trunk/libc/locale/programs/simple-hash.c
    fsf/trunk/libc/locale/programs/simple-hash.h
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/locales/et_EE
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/pthread_cond_timedwait.c
    fsf/trunk/libc/posix/Makefile
    fsf/trunk/libc/posix/glob.c
    fsf/trunk/libc/posix/tst-gnuglob.c
    fsf/trunk/libc/string/test-memcmp.c
    fsf/trunk/libc/sysdeps/posix/cuserid.c
    fsf/trunk/libc/sysdeps/unix/getlogin.c
    fsf/trunk/libc/sysdeps/unix/getlogin_r.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/mmap64.c
    fsf/trunk/libc/sysdeps/x86_64/multiarch/strpbrk-c.c
    fsf/trunk/libc/wcsmbs/wchar.h
    fsf/trunk/libc/wctype/wctype.h

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Thu Mar 25 00:03:15 2010
@@ -1,3 +1,75 @@
+2010-03-16  Chris Demetriou  <cgd@xxxxxxxxxx>
+
+	* locale/programs/simple-hash.c: Include inttypes.h.
+	(hashval_t): Defined to be uint32_t.
+	* locale/programs/simple_hash.h: Include inttypes.h.
+	(compute_hashval): Change return type to uint32_t.
+
+2010-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/unix/sysv/linux/getlogin_r.c: New file.
+	* sysdeps/unix/sysv/linux/getlogin.c: New file.
+	* sysdeps/unix/getlogin_r.c: Allow compiling getlogin as static
+	function.
+	* sysdeps/unix/getlogin.c: Likewise.  Move name variable to toplevel.
+	* include/unistd.h: Declare __getlogin_r_loginuid.
+
+	[BZ #11397]
+	* sysdeps/posix/cuserid.c (cuserid): Make sure the returned string
+	is NUL terminated.
+	Patch by Jonathan Geisler <jgeisler@xxxxxxxxxxxxxx>.
+
+	* sysdeps/unix/sysv/linux/mmap64.c: Allow variable shift values.
+
+2010-03-24  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* sysdeps/x86_64/multiarch/strpbrk-c.c: Define only if SHARED
+	is defined.
+
+2010-03-22  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	* string/test-memcmp.c (check_result): New function.
+	(do_one_test): Use it.
+	(check1): New function.
+	(test_main): Use it.
+
+2010-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* posix/tst-gnuglob.c: Add tests with empty patterns.  For this
+	rewrite the tests to add support for failing glob calls.
+	Some other minor cleanups.
+	* posix/bug-glob3.c: New file.
+	* posix/Makefile (tests): Add bug-glob3.
+
+2010-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+	    Andreas Schwab  <andreas@xxxxxxxxxx>
+
+	* posix/glob.c (glob): Clean up gl_pathc and gl_pathv earlier.
+	If pattern is "" bail out early
+
+2010-03-23  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* elf/dl-lookup.c (do_lookup_x): If tab->entries is NULL,
+	but tab->size != 0, just unlock and goto success, without
+	allocating anything or entering anything into the hash table.
+	(_dl_debug_bindings): Temporarily set tab->entries to NULL
+	around do_lookup_x in undef_map->l_local_scope[0].  If
+	undef_map->l_symbolic_in_local_scope, lookup also in
+	symbolic_searchlist of following libraries in l_local_scope
+	that have DT_SYMBOLIC set.
+	* elf/dl-deps.c (_dl_map_object_deps): Compute
+	l_symbolic_in_local_scope.
+	* include/link.h (struct link_map): Add l_symbolic_in_local_scope
+	bitfield.
+
+2010-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #11410]
+	* wctype/wctype.h: Use <wchar.h> to get the wint_t definition.
+
+	* wcsmbs/wchar.h: Correct preprocessor directive indentation.  Move
+	C++ prototype handling to a better place.
+
 2010-03-18  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* elf/dl-load.c (open_verify): Extend expected to the full size of the

Modified: fsf/trunk/libc/elf/dl-deps.c
==============================================================================
--- fsf/trunk/libc/elf/dl-deps.c (original)
+++ fsf/trunk/libc/elf/dl-deps.c Thu Mar 25 00:03:15 2010
@@ -1,5 +1,5 @@
 /* Load the dependencies of a mapped object.
-   Copyright (C) 1996-2003, 2004, 2005, 2006, 2007
+   Copyright (C) 1996-2003, 2004, 2005, 2006, 2007, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -554,7 +554,12 @@
 	  cnt = _dl_build_local_scope (l_initfini, l);
 	  assert (cnt <= nlist);
 	  for (j = 0; j < cnt; j++)
-	    l_initfini[j]->l_reserved = 0;
+	    {
+	      l_initfini[j]->l_reserved = 0;
+	      if (j && __builtin_expect (l_initfini[j]->l_info[DT_SYMBOLIC]
+					 != NULL, 0))
+		l->l_symbolic_in_local_scope = true;
+	    }
 
 	  l->l_local_scope[0] =
 	    (struct r_scope_elem *) malloc (sizeof (struct r_scope_elem)

Modified: fsf/trunk/libc/elf/dl-lookup.c
==============================================================================
--- fsf/trunk/libc/elf/dl-lookup.c (original)
+++ fsf/trunk/libc/elf/dl-lookup.c Thu Mar 25 00:03:15 2010
@@ -1,5 +1,6 @@
 /* Look up a symbol in the loaded objects.
-   Copyright (C) 1995-2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2005, 2006, 2007, 2009, 2010
+   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
@@ -414,6 +415,20 @@
 		  assert (!RTLD_CHECK_FOREIGN_CALL);
 #endif
 
+#ifdef SHARED
+		  /* If tab->entries is NULL, but tab->size is not, it means
+		     this is the second, conflict finding, lookup for
+		     LD_TRACE_PRELINKING in _dl_debug_bindings.  Don't
+		     allocate anything and don't enter anything into the
+		     hash table.  */
+		  if (__builtin_expect (tab->size, 0))
+		    {
+		      assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK);
+		      __rtld_lock_unlock_recursive (tab->lock);
+		      goto success;
+		    }
+#endif
+
 #define INITIAL_NUNIQUE_SYM_TABLE 31
 		  size = INITIAL_NUNIQUE_SYM_TABLE;
 		  entries = calloc (sizeof (struct unique_sym), size);
@@ -917,13 +932,48 @@
 	{
 	  const uint_fast32_t new_hash = dl_new_hash (undef_name);
 	  unsigned long int old_hash = 0xffffffff;
-
+	  struct unique_sym *saved_entries
+	    = GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries;
+
+	  GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries = NULL;
 	  do_lookup_x (undef_name, new_hash, &old_hash, *ref, &val,
 		       undef_map->l_local_scope[0], 0, version, 0, NULL,
 		       type_class, undef_map);
-
 	  if (val.s != value->s || val.m != value->m)
 	    conflict = 1;
+	  else if (__builtin_expect (undef_map->l_symbolic_in_local_scope, 0)
+		   && val.s
+		   && __builtin_expect (ELFW(ST_BIND) (val.s->st_info),
+					STB_GLOBAL) == STB_GNU_UNIQUE)
+	    {
+	      /* If it is STB_GNU_UNIQUE and undef_map's l_local_scope
+		 contains any DT_SYMBOLIC libraries, unfortunately there
+		 can be conflicts even if the above is equal.  As symbol
+		 resolution goes from the last library to the first and
+		 if a STB_GNU_UNIQUE symbol is found in some late DT_SYMBOLIC
+		 library, it would be the one that is looked up.  */
+	      struct sym_val val2 = { NULL, NULL };
+	      size_t n;
+	      struct r_scope_elem *scope = undef_map->l_local_scope[0];
+
+	      for (n = 0; n < scope->r_nlist; n++)
+		if (scope->r_list[n] == val.m)
+		  break;
+
+	      for (n++; n < scope->r_nlist; n++)
+		if (scope->r_list[n]->l_info[DT_SYMBOLIC] != NULL
+		    && do_lookup_x (undef_name, new_hash, &old_hash, *ref,
+				    &val2,
+				    &scope->r_list[n]->l_symbolic_searchlist,
+				    0, version, 0, NULL, type_class,
+				    undef_map) > 0)
+		  {
+		    conflict = 1;
+		    val = val2;
+		    break;
+		  }
+	    }
+	  GL(dl_ns)[LM_ID_BASE]._ns_unique_sym_table.entries = saved_entries;
 	}
 
       if (value->s)

Modified: fsf/trunk/libc/include/link.h
==============================================================================
--- fsf/trunk/libc/include/link.h (original)
+++ fsf/trunk/libc/include/link.h Thu Mar 25 00:03:15 2010
@@ -1,6 +1,6 @@
 /* Data structure for communication from the run-time dynamic linker for
    loaded ELF shared objects.
-   Copyright (C) 1995-2006, 2007, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1995-2006, 2007, 2009, 2010 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
@@ -188,6 +188,10 @@
     unsigned int l_contiguous:1; /* Nonzero if inter-segment holes are
 				    mprotected or if no holes are present at
 				    all.  */
+    unsigned int l_symbolic_in_local_scope:1; /* Nonzero if l_local_scope
+						 during LD_TRACE_PRELINKING=1
+						 contains any DT_SYMBOLIC
+						 libraries.  */
 
     /* Collected information about own RPATH directories.  */
     struct r_search_path_struct l_rpath_dirs;

Modified: fsf/trunk/libc/include/unistd.h
==============================================================================
--- fsf/trunk/libc/include/unistd.h (original)
+++ fsf/trunk/libc/include/unistd.h Thu Mar 25 00:03:15 2010
@@ -176,6 +176,9 @@
    unless it is really necessary.  */
 #define __have_pipe2 __have_sock_cloexec
 
+extern int __getlogin_r_loginuid (char *name, size_t namesize)
+     attribute_hidden;
+
 __END_DECLS
 
 #endif

Modified: fsf/trunk/libc/locale/programs/simple-hash.c
==============================================================================
--- fsf/trunk/libc/locale/programs/simple-hash.c (original)
+++ fsf/trunk/libc/locale/programs/simple-hash.c Thu Mar 25 00:03:15 2010
@@ -21,6 +21,7 @@
 # include <config.h>
 #endif
 
+#include <inttypes.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -49,6 +50,7 @@
 # define bcopy(s, d, n)	memcpy ((d), (s), (n))
 #endif
 
+#define hashval_t uint32_t
 #include "hashval.h"
 
 extern void *xmalloc (size_t __n);

Modified: fsf/trunk/libc/locale/programs/simple-hash.h
==============================================================================
--- fsf/trunk/libc/locale/programs/simple-hash.h (original)
+++ fsf/trunk/libc/locale/programs/simple-hash.h Thu Mar 25 00:03:15 2010
@@ -19,6 +19,7 @@
 #ifndef _SIMPLE_HASH_H
 #define _SIMPLE_HASH_H
 
+#include <inttypes.h>
 #include <obstack.h>
 
 typedef struct hash_table
@@ -45,7 +46,7 @@
 			  const void **key, size_t *keylen, void **data)
      __THROW;
 
-extern unsigned long int compute_hashval (const void *key, size_t keylen)
+extern uint32_t compute_hashval (const void *key, size_t keylen)
      __THROW;
 extern unsigned long int next_prime (unsigned long int seed) __THROW;
 

Modified: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Thu Mar 25 00:03:15 2010
@@ -1,3 +1,9 @@
+2010-03-24  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #10554]
+	* locales/et_EE: Change first_weekday and first_workday.
+	Patch by Priit Laes <plaes@xxxxxxxxx>.
+
 2010-02-16  Paul Pluzhnikov  <ppluzhnikov@xxxxxxxxxx>
 
 	* Makefile: Add missing gconv-modules dependency.

Modified: fsf/trunk/libc/localedata/locales/et_EE
==============================================================================
--- fsf/trunk/libc/localedata/locales/et_EE (original)
+++ fsf/trunk/libc/localedata/locales/et_EE Thu Mar 25 00:03:15 2010
@@ -209,7 +209,7 @@
 % letter;accent;case;specials
 
 order_start forward;backward/
-            ;forward;position
+	    ;forward;position
 
 % <CAPITAL> or <SMALL> letters first:
 
@@ -2197,8 +2197,8 @@
 <U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
 <U0025><U005A><U0020><U0025><U0059>"
 week    7;19971130;4
-first_weekday 1
-first_workday 1
+first_weekday 2
+first_workday 2
 END LC_TIME
 
 LC_MESSAGES
@@ -2232,12 +2232,12 @@
 
 LC_ADDRESS
 postal_fmt      "<U0025><U0061><U0025><U004E>/
-                 <U0025><U0066><U0025><U004E>/
-                 <U0025><U0064><U0025><U004E>/
-                 <U0025><U0062><U0025><U004E>/
-                 <U0025><U0073><U0025><U0074><U0025><U0068><U0025><U0074><U0025><U0065><U0025><U0074><U0025><U0072><U0025><U004E>/
-                 <U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025><U004E>/
-                 <U0025><U0063><U0025><U004E>"
+		 <U0025><U0066><U0025><U004E>/
+		 <U0025><U0064><U0025><U004E>/
+		 <U0025><U0062><U0025><U004E>/
+		 <U0025><U0073><U0025><U0074><U0025><U0068><U0025><U0074><U0025><U0065><U0025><U0074><U0025><U0072><U0025><U004E>/
+		 <U0025><U0043><U002D><U0025><U007A><U0020><U0025><U0054><U0025><U004E>/
+		 <U0025><U0063><U0025><U004E>"
 country_name    "<U0045><U0065><U0073><U0074><U0069>"
 country_post    "<U0045><U0045>"
 country_ab2     "<U0045><U0045>"

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Thu Mar 25 00:03:15 2010
@@ -1,3 +1,10 @@
+2010-03-23  Luis Machado  <luisgpm@xxxxxxxxxx>
+
+	* pthread_cond_timedwait.c: Add check for
+	HAVE_CLOCK_GETTIME_VSYSCALL to use VDSO whenever possible.
+	(pthread_cond_timedwait): Use INTERNAL_VSYSCALL instead of
+	INTERNAL_SYSCALL.
+
 2010-03-09  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* pthread_create.c (__pthread_create_2_1): If priorities are incorrect

Modified: fsf/trunk/libc/nptl/pthread_cond_timedwait.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cond_timedwait.c (original)
+++ fsf/trunk/libc/nptl/pthread_cond_timedwait.c Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Martin Schwidefsky <schwidefsky@xxxxxxxxxx>, 2003.
 
@@ -27,6 +27,14 @@
 
 #include <shlib-compat.h>
 
+#ifndef HAVE_CLOCK_GETTIME_VSYSCALL
+# undef INTERNAL_VSYSCALL
+# define INTERNAL_VSYSCALL INTERNAL_SYSCALL
+# undef INLINE_VSYSCALL
+# define INLINE_VSYSCALL INLINE_SYSCALL
+#else
+# include <bits/libc-vdso.h>
+#endif
 
 /* Cleanup handler, defined in pthread_cond_wait.c.  */
 extern void __condvar_cleanup (void *arg)
@@ -102,7 +110,7 @@
 #ifdef __NR_clock_gettime
 	INTERNAL_SYSCALL_DECL (err);
 	int ret;
-	ret = INTERNAL_SYSCALL (clock_gettime, err, 2,
+	ret = INTERNAL_VSYSCALL (clock_gettime, err, 2,
 				(cond->__data.__nwaiters
 				 & ((1 << COND_NWAITERS_SHIFT) - 1)),
 				&rt);

Modified: fsf/trunk/libc/posix/Makefile
==============================================================================
--- fsf/trunk/libc/posix/Makefile (original)
+++ fsf/trunk/libc/posix/Makefile Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2000-2006, 2007, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999, 2000-2007, 2009, 2010 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
@@ -86,7 +86,7 @@
 		   tst-nice tst-nanosleep tst-regex2 \
 		   transbug tst-rxspencer tst-pcre tst-boost \
 		   bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
-		   tst-getaddrinfo2 bug-glob1 bug-glob2 tst-sysconf \
+		   tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
 		   tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
 		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
 		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \

Added: fsf/trunk/libc/posix/bug-glob3.c
==============================================================================
--- fsf/trunk/libc/posix/bug-glob3.c (added)
+++ fsf/trunk/libc/posix/bug-glob3.c Thu Mar 25 00:03:15 2010
@@ -1,0 +1,45 @@
+#include <glob.h>
+#include <stdio.h>
+#include <string.h>
+
+static int
+do_test (void)
+{
+  int result = 0;
+  glob_t g;
+  g.gl_pathc = 0;
+
+  int r = glob ("", 0, NULL, &g);
+  if (r != GLOB_NOMATCH)
+    {
+      puts ("glob (\"\", 0, NULL, &g) did not fail");
+      result = 1;
+    }
+  else if (g.gl_pathc != 0)
+    {
+      puts ("gl_pathc after glob (\"\", 0, NULL, &g) not zero");
+      result = 1;
+    }
+
+  r = glob ("", GLOB_NOCHECK, NULL, &g);
+  if (r != 0)
+    {
+      puts ("glob (\"\", GLOB_NOCHECK, NULL, &g) did fail");
+      result = 1;
+    }
+  else if (g.gl_pathc != 1)
+    {
+      puts ("gl_pathc after glob (\"\", GLOB_NOCHECK, NULL, &g) not 1");
+      result = 1;
+    }
+  else if (strcmp (g.gl_pathv[0], "") != 0)
+    {
+      puts ("gl_pathv[0] after glob (\"\", GLOB_NOCHECK, NULL, &g) not \"\"");
+      result = 1;
+    }
+
+  return result;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/posix/glob.c
==============================================================================
--- fsf/trunk/libc/posix/glob.c (original)
+++ fsf/trunk/libc/posix/glob.c Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008
+/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -418,6 +418,24 @@
 	}
     }
 
+  if (!(flags & GLOB_APPEND))
+    {
+      pglob->gl_pathc = 0;
+      if (!(flags & GLOB_DOOFFS))
+	pglob->gl_pathv = NULL;
+      else
+	{
+	  size_t i;
+	  pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1)
+					      * sizeof (char *));
+	  if (pglob->gl_pathv == NULL)
+	    return GLOB_NOSPACE;
+
+	  for (i = 0; i <= pglob->gl_offs; ++i)
+	    pglob->gl_pathv[i] = NULL;
+	}
+    }
+
   /* Find the filename.  */
   filename = strrchr (pattern, '/');
 #if defined __MSDOS__ || defined WINDOWS32
@@ -445,6 +463,12 @@
 	}
       else
 	{
+	  if (__builtin_expect (pattern[0] == '\0', 0))
+	    {
+	      dirs.gl_pathv = NULL;
+	      goto no_matches;
+	    }
+
 	  filename = pattern;
 #ifdef _AMIGA
 	  dirname = "";
@@ -492,7 +516,7 @@
 
       if (filename[0] == '\0'
 #if defined __MSDOS__ || defined WINDOWS32
-          && dirname[dirlen - 1] != ':'
+	  && dirname[dirlen - 1] != ':'
 	  && (dirlen < 3 || dirname[dirlen - 2] != ':'
 	      || dirname[dirlen - 1] != '/')
 #endif
@@ -526,24 +550,6 @@
 	      goto no_matches;
 	    }
 	  return val;
-	}
-    }
-
-  if (!(flags & GLOB_APPEND))
-    {
-      pglob->gl_pathc = 0;
-      if (!(flags & GLOB_DOOFFS))
-        pglob->gl_pathv = NULL;
-      else
-	{
-	  size_t i;
-	  pglob->gl_pathv = (char **) malloc ((pglob->gl_offs + 1)
-					      * sizeof (char *));
-	  if (pglob->gl_pathv == NULL)
-	    return GLOB_NOSPACE;
-
-	  for (i = 0; i <= pglob->gl_offs; ++i)
-	    pglob->gl_pathv[i] = NULL;
 	}
     }
 
@@ -564,7 +570,7 @@
 # else
 #  ifdef WINDOWS32
 	  if (home_dir == NULL || home_dir[0] == '\0')
-            home_dir = "c:/users/default"; /* poor default */
+	    home_dir = "c:/users/default"; /* poor default */
 #  else
 	  if (home_dir == NULL || home_dir[0] == '\0')
 	    {

Modified: fsf/trunk/libc/posix/tst-gnuglob.c
==============================================================================
--- fsf/trunk/libc/posix/tst-gnuglob.c (original)
+++ fsf/trunk/libc/posix/tst-gnuglob.c Thu Mar 25 00:03:15 2010
@@ -1,6 +1,6 @@
 /* Test the GNU extensions in glob which allow the user to provide callbacks
    for the filesystem access functions.
-   Copyright (C) 2001-2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2001-2002, 2007, 2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2001.
 
@@ -61,9 +61,9 @@
       { "..", 3, DT_DIR },
       { ".foo", 3, DT_REG },
       { "dir1lev3", 3, DT_DIR },
-        { ".", 4, DT_DIR },
-        { "..", 4, DT_DIR },
-        { "file1lev4", 4, DT_REG },
+	{ ".", 4, DT_DIR },
+	{ "..", 4, DT_DIR },
+	{ "file1lev4", 4, DT_REG },
       { "file1lev3", 3, DT_REG },
       { "file2lev3", 3, DT_REG },
     { "file2lev2", 2, DT_REG },
@@ -81,9 +81,9 @@
       { "..", 3, DT_DIR },
       { ".foo", 3, DT_REG },
       { ".dir", 3, DT_DIR },
-        { ".", 4, DT_DIR },
-        { "..", 4, DT_DIR },
-        { "hidden", 4, DT_REG }
+	{ ".", 4, DT_DIR },
+	{ "..", 4, DT_DIR },
+	{ "hidden", 4, DT_REG }
 };
 #define nfiles (sizeof (filesystem) / sizeof (filesystem[0]))
 
@@ -283,7 +283,7 @@
 static const char *
 flagstr (int flags)
 {
-  const char *strs[] =
+  static const char *const strs[] =
   {
     "GLOB_ERR", "GLOB_MARK", "GLOB_NOSORT", "GLOB_DOOFSS", "GLOB_NOCHECK",
     "GLOB_APPEND", "GLOB_NOESCAPE", "GLOB_PERIOD", "GLOB_MAGCHAR",
@@ -312,6 +312,29 @@
     }
 
   return buf;
+#undef nstrs
+}
+
+
+static const char *
+errstr (int val)
+{
+  static const char *const strs[] =
+    {
+      [GLOB_NOSPACE] = "GLOB_NOSPACE",
+      [GLOB_ABORTED] = "GLOB_ABORTED",
+      [GLOB_NOMATCH] = "GLOB_NOMATCH",
+      [GLOB_NOSYS] = "GLOB_NOSYS"
+    };
+#define nstrs (sizeof (strs) / sizeof (strs[0]))
+  static char buf[100];
+  if (val < 0 || val >= nstrs || strs[val] == NULL)
+    {
+      snprintf (buf, sizeof (buf), "GLOB_??? (%d)", val);
+      return buf;
+    }
+  return strs[val];
+#undef nstrs
 }
 
 
@@ -376,28 +399,34 @@
   gl.gl_lstat = my_stat;
   gl.gl_stat = my_stat;
 
-#define test(a, b, c...) \
+#define test(a, b, r, c...) \
   fmt = a;								      \
-  flags = b;								      \
+  flags = GLOB_ALTDIRFUNC | b;						      \
   errval = glob (fmt, flags, NULL, &gl);				      \
-  if (errval != 0)							      \
+  if (errval != r)							      \
     {									      \
-      printf ("glob (\"%s\", %s) failed: %s\n", fmt, flagstr (flags),	      \
-	      errval >= 0 && errval < nglob_errstring			      \
-	      ? glob_errstring[errval] : "???");			      \
+      if (r == 0)							      \
+	printf ("glob (\"%s\", %s) failed: %s\n", fmt, flagstr (flags),	      \
+		errval >= 0 && errval < nglob_errstring			      \
+		? glob_errstring[errval] : "???");			      \
+      else								      \
+	printf ("glob (\"%s\", %s) did not fail\n", fmt, flagstr (flags));    \
       result = 1;							      \
     }									      \
+  else if (r == 0)							      \
+    result |= test_result (fmt, flags, &gl, (const char *[]) { c, NULL });    \
   else									      \
-    result |= test_result (fmt, flags, &gl, (const char *[]) { c, NULL })
-
-  test ("*/*/*", GLOB_ALTDIRFUNC,
+    printf ("result for glob (\"%s\", %s) = %s\n\n", fmt, flagstr (flags),    \
+	    errstr (errval))
+
+  test ("*/*/*", 0, 0,
 	"dir1lev1/dir2lev2/dir1lev3",
 	"dir1lev1/dir2lev2/file1lev3",
 	"dir1lev1/dir2lev2/file2lev3",
 	"dir1lev1/dir3lev2/file3lev3",
 	"dir1lev1/dir3lev2/file4lev3");
 
-  test ("*/*/*", GLOB_ALTDIRFUNC | GLOB_PERIOD,
+  test ("*/*/*", GLOB_PERIOD, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir1lev1/dir2lev2/.",
@@ -415,7 +444,7 @@
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("*/*/.*", GLOB_ALTDIRFUNC,
+  test ("*/*/.*", 0, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir1lev1/dir2lev2/.",
@@ -428,7 +457,7 @@
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("*1*/*2*/.*", GLOB_ALTDIRFUNC,
+  test ("*1*/*2*/.*", 0, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir1lev1/dir2lev2/.",
@@ -441,7 +470,7 @@
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("*1*/*1*/.*", GLOB_ALTDIRFUNC,
+  test ("*1*/*1*/.*", 0, 0,
 	"dir1lev1/dir1lev2/.",
 	"dir1lev1/dir1lev2/..",
 	"dir2lev1/dir1lev2/.",
@@ -449,12 +478,16 @@
 	"dir2lev1/dir1lev2/.dir",
 	"dir2lev1/dir1lev2/.foo");
 
-  test ("\\/*", GLOB_ALTDIRFUNC,
+  test ("\\/*", 0, 0,
 	"/dir1lev1",
 	"/dir2lev1",
 	"/file1lev1",
 	"/file2lev1");
 
+  test ("", 0, GLOB_NOMATCH, NULL);
+
+  test ("", GLOB_NOCHECK, 0, "");
+
   globfree (&gl);
 
   return result;

Modified: fsf/trunk/libc/string/test-memcmp.c
==============================================================================
--- fsf/trunk/libc/string/test-memcmp.c (original)
+++ fsf/trunk/libc/string/test-memcmp.c Thu Mar 25 00:03:15 2010
@@ -37,9 +37,9 @@
   return ret;
 }
 
-static void
-do_one_test (impl_t *impl, const char *s1, const char *s2, size_t len,
-	     int exp_result)
+static int
+check_result (impl_t *impl, const char *s1, const char *s2, size_t len,
+	      int exp_result)
 {
   int result = CALL (impl, s1, s2, len);
   if ((exp_result == 0 && result != 0)
@@ -49,8 +49,18 @@
       error (0, 0, "Wrong result in function %s %d %d", impl->name,
 	     result, exp_result);
       ret = 1;
-      return;
-    }
+      return -1;
+    }
+
+  return 0;
+}
+
+static void
+do_one_test (impl_t *impl, const char *s1, const char *s2, size_t len,
+	     int exp_result)
+{
+  if (check_result (impl, s1, s2, len, exp_result) < 0)
+    return;
 
   if (HP_TIMING_AVAIL)
     {
@@ -177,12 +187,259 @@
     }
 }
 
+static void
+check1 (void)
+{
+  char s1[116], s2[116];
+  int n, exp_result;
+
+  s1[0] = -108;
+  s2[0] = -108;
+  s1[1] = 99;
+  s2[1] = 99;
+  s1[2] = -113;
+  s2[2] = -113;
+  s1[3] = 1;
+  s2[3] = 1;
+  s1[4] = 116;
+  s2[4] = 116;
+  s1[5] = 99;
+  s2[5] = 99;
+  s1[6] = -113;
+  s2[6] = -113;
+  s1[7] = 1;
+  s2[7] = 1;
+  s1[8] = 84;
+  s2[8] = 84;
+  s1[9] = 99;
+  s2[9] = 99;
+  s1[10] = -113;
+  s2[10] = -113;
+  s1[11] = 1;
+  s2[11] = 1;
+  s1[12] = 52;
+  s2[12] = 52;
+  s1[13] = 99;
+  s2[13] = 99;
+  s1[14] = -113;
+  s2[14] = -113;
+  s1[15] = 1;
+  s2[15] = 1;
+  s1[16] = -76;
+  s2[16] = -76;
+  s1[17] = -14;
+  s2[17] = -14;
+  s1[18] = -109;
+  s2[18] = -109;
+  s1[19] = 1;
+  s2[19] = 1;
+  s1[20] = -108;
+  s2[20] = -108;
+  s1[21] = -14;
+  s2[21] = -14;
+  s1[22] = -109;
+  s2[22] = -109;
+  s1[23] = 1;
+  s2[23] = 1;
+  s1[24] = 84;
+  s2[24] = 84;
+  s1[25] = -15;
+  s2[25] = -15;
+  s1[26] = -109;
+  s2[26] = -109;
+  s1[27] = 1;
+  s2[27] = 1;
+  s1[28] = 52;
+  s2[28] = 52;
+  s1[29] = -15;
+  s2[29] = -15;
+  s1[30] = -109;
+  s2[30] = -109;
+  s1[31] = 1;
+  s2[31] = 1;
+  s1[32] = 20;
+  s2[32] = 20;
+  s1[33] = -15;
+  s2[33] = -15;
+  s1[34] = -109;
+  s2[34] = -109;
+  s1[35] = 1;
+  s2[35] = 1;
+  s1[36] = 20;
+  s2[36] = 20;
+  s1[37] = -14;
+  s2[37] = -14;
+  s1[38] = -109;
+  s2[38] = -109;
+  s1[39] = 1;
+  s2[39] = 1;
+  s1[40] = 52;
+  s2[40] = 52;
+  s1[41] = -14;
+  s2[41] = -14;
+  s1[42] = -109;
+  s2[42] = -109;
+  s1[43] = 1;
+  s2[43] = 1;
+  s1[44] = 84;
+  s2[44] = 84;
+  s1[45] = -14;
+  s2[45] = -14;
+  s1[46] = -109;
+  s2[46] = -109;
+  s1[47] = 1;
+  s2[47] = 1;
+  s1[48] = 116;
+  s2[48] = 116;
+  s1[49] = -14;
+  s2[49] = -14;
+  s1[50] = -109;
+  s2[50] = -109;
+  s1[51] = 1;
+  s2[51] = 1;
+  s1[52] = 116;
+  s2[52] = 116;
+  s1[53] = -15;
+  s2[53] = -15;
+  s1[54] = -109;
+  s2[54] = -109;
+  s1[55] = 1;
+  s2[55] = 1;
+  s1[56] = -44;
+  s2[56] = -44;
+  s1[57] = -14;
+  s2[57] = -14;
+  s1[58] = -109;
+  s2[58] = -109;
+  s1[59] = 1;
+  s2[59] = 1;
+  s1[60] = -108;
+  s2[60] = -108;
+  s1[61] = -15;
+  s2[61] = -15;
+  s1[62] = -109;
+  s2[62] = -109;
+  s1[63] = 1;
+  s2[63] = 1;
+  s1[64] = -76;
+  s2[64] = -76;
+  s1[65] = -15;
+  s2[65] = -15;
+  s1[66] = -109;
+  s2[66] = -109;
+  s1[67] = 1;
+  s2[67] = 1;
+  s1[68] = -44;
+  s2[68] = -44;
+  s1[69] = -15;
+  s2[69] = -15;
+  s1[70] = -109;
+  s2[70] = -109;
+  s1[71] = 1;
+  s2[71] = 1;
+  s1[72] = -12;
+  s2[72] = -12;
+  s1[73] = -15;
+  s2[73] = -15;
+  s1[74] = -109;
+  s2[74] = -109;
+  s1[75] = 1;
+  s2[75] = 1;
+  s1[76] = -12;
+  s2[76] = -12;
+  s1[77] = -14;
+  s2[77] = -14;
+  s1[78] = -109;
+  s2[78] = -109;
+  s1[79] = 1;
+  s2[79] = 1;
+  s1[80] = 20;
+  s2[80] = -68;
+  s1[81] = -12;
+  s2[81] = 64;
+  s1[82] = -109;
+  s2[82] = -106;
+  s1[83] = 1;
+  s2[83] = 1;
+  s1[84] = -12;
+  s2[84] = -12;
+  s1[85] = -13;
+  s2[85] = -13;
+  s1[86] = -109;
+  s2[86] = -109;
+  s1[87] = 1;
+  s2[87] = 1;
+  s1[88] = -44;
+  s2[88] = -44;
+  s1[89] = -13;
+  s2[89] = -13;
+  s1[90] = -109;
+  s2[90] = -109;
+  s1[91] = 1;
+  s2[91] = 1;
+  s1[92] = -76;
+  s2[92] = -76;
+  s1[93] = -13;
+  s2[93] = -13;
+  s1[94] = -109;
+  s2[94] = -109;
+  s1[95] = 1;
+  s2[95] = 1;
+  s1[96] = -108;
+  s2[96] = -108;
+  s1[97] = -13;
+  s2[97] = -13;
+  s1[98] = -109;
+  s2[98] = -109;
+  s1[99] = 1;
+  s2[99] = 1;
+  s1[100] = 116;
+  s2[100] = 116;
+  s1[101] = -13;
+  s2[101] = -13;
+  s1[102] = -109;
+  s2[102] = -109;
+  s1[103] = 1;
+  s2[103] = 1;
+  s1[104] = 84;
+  s2[104] = 84;
+  s1[105] = -13;
+  s2[105] = -13;
+  s1[106] = -109;
+  s2[106] = -109;
+  s1[107] = 1;
+  s2[107] = 1;
+  s1[108] = 52;
+  s2[108] = 52;
+  s1[109] = -13;
+  s2[109] = -13;
+  s1[110] = -109;
+  s2[110] = -109;
+  s1[111] = 1;
+  s2[111] = 1;
+  s1[112] = 20;
+  s2[112] = 20;
+  s1[113] = -13;
+  s2[113] = -13;
+  s1[114] = -109;
+  s2[114] = -109;
+  s1[115] = 1;
+  s2[115] = 1;
+
+  n = 116;
+  exp_result = simple_memcmp (s1, s2, n);
+  FOR_EACH_IMPL (impl, 0)
+    check_result (impl, s1, s2, n, exp_result);
+}
+
 int
 test_main (void)
 {
   size_t i;
 
   test_init ();
+
+  check1 ();
 
   printf ("%23s", "");
   FOR_EACH_IMPL (impl, 0)

Modified: fsf/trunk/libc/sysdeps/posix/cuserid.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/cuserid.c (original)
+++ fsf/trunk/libc/sysdeps/posix/cuserid.c Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1996, 1998, 1999, 2001 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1996, 1998, 1999, 2001, 2010 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
@@ -44,5 +44,6 @@
 
   if (s == NULL)
     s = name;
-  return strncpy (s, pwptr->pw_name, L_cuserid);
+  s[L_userid - 1] = '\0';
+  return strncpy (s, pwptr->pw_name, L_cuserid - 1);
 }

Modified: fsf/trunk/libc/sysdeps/unix/getlogin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/getlogin.c (original)
+++ fsf/trunk/libc/sysdeps/unix/getlogin.c Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1992, 1996, 1997, 2010 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
@@ -25,16 +25,20 @@
 
 #include <utmp.h>
 
+static char name[UT_NAMESIZE + 1];
+
 /* Return the login name of the user, or NULL if it can't be determined.
    The returned pointer, if not NULL, is good only until the next call.  */
 
+#ifdef STATIC
+STATIC
+#endif
 char *
 getlogin (void)
 {
   char tty_pathname[2 + 2 * NAME_MAX];
   char *real_tty_path = tty_pathname;
   char *result = NULL;
-  static char name[UT_NAMESIZE + 1];
   struct utmp *ut, line, buffer;
 
   /* Get name of tty connected to fd 0.  Return NULL if not a tty or

Modified: fsf/trunk/libc/sysdeps/unix/getlogin_r.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/getlogin_r.c (original)
+++ fsf/trunk/libc/sysdeps/unix/getlogin_r.c Thu Mar 25 00:03:15 2010
@@ -1,5 +1,5 @@
 /* Reentrant function to return the current login name.  Unix version.
-   Copyright (C) 1991,92,96,97,98,2002 Free Software Foundation, Inc.
+   Copyright (C) 1991,92,96,97,98,2002,2010 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
@@ -31,6 +31,9 @@
    If it cannot be determined or some other error occurred, return the error
    code.  Otherwise return 0.  */
 
+#ifdef STATIC
+STATIC
+#endif
 int
 getlogin_r (name, name_len)
      char *name;
@@ -96,4 +99,6 @@
 
   return result;
 }
+#ifndef STATIC
 libc_hidden_def (getlogin_r)
+#endif

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin.c Thu Mar 25 00:03:15 2010
@@ -1,0 +1,39 @@
+/* Copyright (C) 2010 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pwd.h>
+#include <unistd.h>
+#include <not-cancel.h>
+
+#define STATIC static
+#define getlogin getlogin_fd0
+#include <sysdeps/unix/getlogin.c>
+#undef getlogin
+
+
+/* Return the login name of the user, or NULL if it can't be determined.
+   The returned pointer, if not NULL, is good only until the next call.  */
+
+char *
+getlogin (void)
+{
+  if (__getlogin_r_loginuid (name, sizeof (name)) == 0)
+    return name;
+
+  return getlogin_fd0 ();
+}

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getlogin_r.c Thu Mar 25 00:03:15 2010
@@ -1,0 +1,100 @@
+/* Copyright (C) 2010 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <pwd.h>
+#include <unistd.h>
+#include <not-cancel.h>
+
+#define STATIC static
+static int getlogin_r_fd0 (char *name, size_t namesize);
+#define getlogin_r getlogin_r_fd0
+#include <sysdeps/unix/getlogin_r.c>
+#undef getlogin_r
+
+
+int
+attribute_hidden
+__getlogin_r_loginuid (name, namesize)
+     char *name;
+     size_t namesize;
+{
+  int fd = open_not_cancel_2 ("/proc/self/loginuid", O_RDONLY);
+  if (fd == -1)
+    return 1;
+
+  ssize_t n = TEMP_FAILURE_RETRY (read_not_cancel (fd, name, namesize));
+  close_not_cancel_no_status (fd);
+
+  uid_t uid;
+  char *endp;
+  if (n <= 0
+      || (uid = strtoul (name, &endp, 10), endp == name || *endp != '\0'))
+    return 1;
+
+  size_t buflen = 1024;
+  char *buf = alloca (buflen);
+  bool use_malloc = false;
+  struct passwd pwd;
+  struct passwd *tpwd;
+  int res;
+
+  while ((res = __getpwuid_r (uid, &pwd, buf, buflen, &tpwd)) != 0)
+    if (__libc_use_alloca (2 * buflen))
+      extend_alloca (buf, buflen, 2 * buflen);
+    else
+      {
+	buflen *= 2;
+	char *newp = realloc (use_malloc ? buf : NULL, buflen);
+	if (newp == NULL)
+	  {
+	  fail:
+	    if (use_malloc)
+	      free (buf);
+	    return 1;
+	  }
+	buf = newp;
+	use_malloc = true;
+      }
+
+  if (tpwd == NULL)
+    goto fail;
+
+  strncpy (name, pwd.pw_name, namesize - 1);
+  name[namesize - 1] = '\0';
+
+  if (use_malloc)
+    free (buf);
+
+  return 0;
+}
+
+
+/* Return the login name of the user, or NULL if it can't be determined.
+   The returned pointer, if not NULL, is good only until the next call.  */
+
+int
+getlogin_r (name, namesize)
+     char *name;
+     size_t namesize;
+{
+  if (__getlogin_r_loginuid (name, namesize) == 0)
+    return 0;
+
+  return getlogin_r_fd0 (name, namesize);
+}
+libc_hidden_def (getlogin_r)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/mmap64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/mmap64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/mmap64.c Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999,2000,2001,2002,2006 Free Software Foundation, Inc.
+/* Copyright (C) 1999,2000,2001,2002,2006,2010 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 1999.
 
@@ -30,8 +30,13 @@
 #ifdef __NR_mmap2
 
 /* This is always 12, even on architectures where PAGE_SHIFT != 12.  */
-# ifndef MMAP2_PAGE_SHIFT
-#  define MMAP2_PAGE_SHIFT 12
+# if MMAP2_PAGE_SHIFT == -1
+static int page_shift;
+# else
+#  ifndef MMAP2_PAGE_SHIFT
+#   define MMAP2_PAGE_SHIFT 12
+#  endif
+# define page_shift MMAP2_PAGE_SHIFT
 # endif
 
 # ifndef __ASSUME_MMAP2_SYSCALL
@@ -44,7 +49,15 @@
 __mmap64 (void *addr, size_t len, int prot, int flags, int fd, off64_t offset)
 {
 #ifdef __NR_mmap2
-  if (offset & ((1 << MMAP2_PAGE_SHIFT) - 1))
+# ifdef MMAP2_PAGE_SHIFT == -1
+  if (page_shift == 0)
+    {
+      int page_size = getpagesize ();
+      while ((1 << ++page_shift) != page_size)
+	;
+    }
+# endif
+  if (offset & ((1 << page_shift) - 1))
     {
       __set_errno (EINVAL);
       return MAP_FAILED;

Modified: fsf/trunk/libc/sysdeps/x86_64/multiarch/strpbrk-c.c
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/multiarch/strpbrk-c.c (original)
+++ fsf/trunk/libc/sysdeps/x86_64/multiarch/strpbrk-c.c Thu Mar 25 00:03:15 2010
@@ -1,4 +1,8 @@
-#define USE_AS_STRPBRK
-#define STRCSPN_SSE2 __strpbrk_sse2
-#define STRCSPN_SSE42 __strpbrk_sse42
-#include "strcspn-c.c"
+/* Don't define multiple versions for strpbrk in static library since we
+   need strpbrk before the initialization happened.  */
+#ifdef SHARED
+# define USE_AS_STRPBRK
+# define STRCSPN_SSE2 __strpbrk_sse2
+# define STRCSPN_SSE42 __strpbrk_sse42
+# include "strcspn-c.c"
+#endif

Modified: fsf/trunk/libc/wcsmbs/wchar.h
==============================================================================
--- fsf/trunk/libc/wcsmbs/wchar.h (original)
+++ fsf/trunk/libc/wcsmbs/wchar.h Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2008, 2009, 2010 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
@@ -50,11 +50,6 @@
 # undef __need_wint_t
 # define __need_wint_t
 # include <stddef.h>
-
-/* Tell the caller that we provide correct C++ prototypes.  */
-#if defined __cplusplus && __GNUC_PREREQ (4, 4)
-# define __CORRECT_ISO_CPP_WCHAR_H_PROTO
-#endif
 
 /* We try to get wint_t from <stddef.h>, but not all GCC versions define it
    there.  So define it ourselves if it remains undefined.  */
@@ -74,6 +69,11 @@
 typedef __WINT_TYPE__ wint_t;
 __END_NAMESPACE_STD
 #  endif
+# endif
+
+/* Tell the caller that we provide correct C++ prototypes.  */
+# if defined __cplusplus && __GNUC_PREREQ (4, 4)
+#  define __CORRECT_ISO_CPP_WCHAR_H_PROTO
 # endif
 #endif
 
@@ -219,7 +219,7 @@
 extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
      __THROW __asm ("wcschr") __attribute_pure__;
 extern "C++" __const wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
-     __THROW __asm ("wcschr")  __attribute_pure__;
+     __THROW __asm ("wcschr") __attribute_pure__;
 #else
 extern wchar_t *wcschr (__const wchar_t *__wcs, wchar_t __wc)
      __THROW __attribute_pure__;
@@ -892,7 +892,7 @@
 
 #endif /* wchar.h  */
 
-/* Undefined all __need_* constants in case we are included to get those
+/* Undefine all __need_* constants in case we are included to get those
    constants but the whole file was already read.  */
 #undef __need_mbstate_t
 #undef __need_wint_t

Modified: fsf/trunk/libc/wctype/wctype.h
==============================================================================
--- fsf/trunk/libc/wctype/wctype.h (original)
+++ fsf/trunk/libc/wctype/wctype.h Thu Mar 25 00:03:15 2010
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2002,2005,2007,2008,2009 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2002,2005,2007-2009,2010 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
@@ -29,9 +29,9 @@
 #ifndef __need_iswxxx
 # define _WCTYPE_H	1
 
-/* Get wint_t from <stddef.h>.  */
+/* Get wint_t from <wchar.h>.  */
 # define __need_wint_t
-# include <stddef.h>
+# include <wchar.h>
 
 /* Constant expression of type `wint_t' whose value does not correspond
    to any member of the extended character set.  */
@@ -204,7 +204,7 @@
 
 
 /* The remaining definitions and declarations must not appear in the
-   <wcsmbs.h> header.  */
+   <wchar.h> header.  */
 #ifdef _WCTYPE_H
 
 /*