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

[commits] r3997 - in /trunk/libc: ./ crypt/ elf/ intl/ localedata/ localedata/locales/ malloc/ manual/ math/ nptl/ nptl/sysdeps/pthrea...



Author: joseph
Date: Sun Oct 28 14:23:33 2007
New Revision: 3997

Log:
Merge changes between r3903 and r3996 from /fsf/trunk.

Added:
    trunk/libc/stdio-common/bug20.c
      - copied unchanged from r3996, fsf/trunk/libc/stdio-common/bug20.c
Modified:
    trunk/libc/BUGS
    trunk/libc/ChangeLog
    trunk/libc/FAQ.in
    trunk/libc/crypt/sha256c-test.c
    trunk/libc/crypt/sha512c-test.c
    trunk/libc/elf/dl-load.c
    trunk/libc/intl/locale.alias
    trunk/libc/localedata/ChangeLog
    trunk/libc/localedata/locales/ig_NG
    trunk/libc/malloc/arena.c
    trunk/libc/manual/libc.texinfo
    trunk/libc/manual/process.texi
    trunk/libc/manual/socket.texi
    trunk/libc/manual/startup.texi
    trunk/libc/manual/stdio.texi
    trunk/libc/manual/sysinfo.texi
    trunk/libc/manual/syslog.texi
    trunk/libc/manual/time.texi
    trunk/libc/math/libm-test.inc
    trunk/libc/nptl/ChangeLog
    trunk/libc/nptl/sysdeps/pthread/malloc-machine.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/fork.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h
    trunk/libc/nptl/sysdeps/unix/sysv/linux/register-atfork.c
    trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c
    trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c
    trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c
    trunk/libc/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
    trunk/libc/nscd/cache.c
    trunk/libc/stdio-common/Makefile
    trunk/libc/stdio-common/vfscanf.c
    trunk/libc/sysdeps/i386/backtrace.c
    trunk/libc/sysdeps/ia64/backtrace.c
    trunk/libc/sysdeps/unix/sysv/linux/readahead.c
    trunk/libc/sysdeps/unix/sysv/linux/sys/epoll.h

Modified: trunk/libc/BUGS
==============================================================================
--- trunk/libc/BUGS (original)
+++ trunk/libc/BUGS Sun Oct 28 14:23:33 2007
@@ -1,7 +1,7 @@
 	    List of known bugs (certainly very incomplete)
 	    ----------------------------------------------
 
-Time-stamp: <2005-09-23 13:25:42 drepper>
+Time-stamp: <2007-10-27 18:37:51 drepper>
 
 This following list contains those bugs which I'm aware of.  Please
 make sure that bugs you report are not listed here.  If you can fix one
@@ -12,12 +12,10 @@
 
        http://sourceware.org/bugzilla/
 
-I would appreciate it very much if you could verify the problem was not
-reported before by looking through the database.  To make the information
-in this database as useful as possible please report bugs always using the
-`glibcbug' shell script which gets installed with GNU libc.  Before reporting
-a bug please check the FAQ since it discusses also a lot of problematic
-situations.
+I would appreciate it very much if you could verify the problem was
+not reported before by looking through the database. Before reporting
+a bug please check the FAQ since it discusses also a lot of
+problematic situations.
 
 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Modified: trunk/libc/ChangeLog
==============================================================================
--- trunk/libc/ChangeLog (original)
+++ trunk/libc/ChangeLog Sun Oct 28 14:23:33 2007
@@ -1,3 +1,52 @@
+2007-10-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5204]
+	* crypt/sha256c-test.c: Define TIMEOUT to 6 for ancient hardware.
+	* crypt/sha512c-test.c: Likewise.
+
+	[BZ #5225]
+	* stdio-common/vfscanf.c (_IO_vfwscanf): Don't misuse wp pointer
+	to keep track of end of %[ format string element.
+	* stdio-common/Makefile (tests): Add bug20.
+	* stdio-common/bug20.c: New file.
+
+	[BZ #5222]
+	* elf/dl-load.c (_dl_rtld_di_serinfo): Correct handling of short
+	path elements in counting mode.
+
+2007-10-27  Andreas Jaeger  <aj@xxxxxxx>
+
+	[BZ #5040]
+	* sysdeps/unix/sysv/linux/sys/epoll.h (EPOLLRDHUP): Add value.
+
+	[BZ #3112]
+	* sysdeps/ia64/backtrace.c (init): Free shared library if incorrect.
+	(__cleanup): Free shared library when exiting.
+	* sysdeps/i386/backtrace.c (init): Free shared library if incorrect.
+	(__cleanup): Free shared library when exiting.
+
+2006-04-14  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
+
+	[BZ #2549]
+	* math/libm-test.inc (check_float_internal): Support
+	denormalized return.
+
+2007-10-23  Andreas Jaeger  <aj@xxxxxxx>
+
+	[BZ #5208]
+	* sysdeps/unix/sysv/linux/readahead.c (__readahead): Use
+	__LONG_LONG_PAIR to handle little endian byte order.
+	Suggested by abhishekrai@xxxxxxxxxx
+
+2007-10-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* malloc/arena.c [!NO_THREADS]: Use ATFORK_MEM if defined.
+
+2007-10-26  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/cache.c (prune_cache): Move test for modified file outside
+	of locking.
+
 2007-10-21  Andreas Jaeger  <aj@xxxxxxx>
 
 	* manual/texinfo.tex: Update to latest version.

Modified: trunk/libc/FAQ.in
==============================================================================
--- trunk/libc/FAQ.in (original)
+++ trunk/libc/FAQ.in Sun Oct 28 14:23:33 2007
@@ -287,12 +287,12 @@
 failure should be looked into.  Depending on the failures, you probably
 should not install the library at all.
 
-You should consider using the `glibcbug' script to report the failure,
-providing as much detail as possible.  If you run a test directly, please
-remember to set up the environment correctly.  You want to test the compiled
-library - and not your installed one.  The best way is to copy the exact
-command line which failed and run the test from the subdirectory for this
-test in the sources.
+You should consider reporting it in bugzilla
+<http://sourceware.org/bugzilla/> providing as much detail as possible.
+If you run a test directly, please remember to set up the environment
+correctly. You want to test the compiled library - and not your installed
+one. The best way is to copy the exact command line which failed and run
+the test from the subdirectory for this test in the sources.
 
 There are some failures which are not directly related to the GNU libc:
 - Some compilers produce buggy code.  No compiler gets single precision

Modified: trunk/libc/crypt/sha256c-test.c
==============================================================================
--- trunk/libc/crypt/sha256c-test.c (original)
+++ trunk/libc/crypt/sha256c-test.c Sun Oct 28 14:23:33 2007
@@ -57,5 +57,6 @@
   return result;
 }
 
+#define TIMEOUT 6
 #define TEST_FUNCTION do_test ()
 #include "../test-skeleton.c"

Modified: trunk/libc/crypt/sha512c-test.c
==============================================================================
--- trunk/libc/crypt/sha512c-test.c (original)
+++ trunk/libc/crypt/sha512c-test.c Sun Oct 28 14:23:33 2007
@@ -58,6 +58,7 @@
   return result;
 }
 
+#define TIMEOUT 6
 #define TEST_FUNCTION do_test ()
 #define TIMEOUT 4
 #include "../test-skeleton.c"

Modified: trunk/libc/elf/dl-load.c
==============================================================================
--- trunk/libc/elf/dl-load.c (original)
+++ trunk/libc/elf/dl-load.c Sun Oct 28 14:23:33 2007
@@ -2274,7 +2274,7 @@
 	      if (counting)
 		{
 		  si->dls_cnt++;
-		  si->dls_size += r->dirnamelen < 2 ? r->dirnamelen : 2;
+		  si->dls_size += MAX (2, r->dirnamelen);
 		}
 	      else
 		{

Modified: trunk/libc/intl/locale.alias
==============================================================================
--- trunk/libc/intl/locale.alias (original)
+++ trunk/libc/intl/locale.alias Sun Oct 28 14:23:33 2007
@@ -1,5 +1,5 @@
 # Locale name alias data base.
-# Copyright (C) 1996-2001,2003 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001,2003,2007 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,10 +21,9 @@
 # A single line contains two fields: an alias and a substitution value.
 # All entries are case independent.
 
-# Note: This file is far from being complete.  If you have a value for
-# your own site which you think might be useful for others too, share
-# it with the rest of us.  Send it using the `glibcbug' script to
-# bugs@xxxxxxxx
+# Note: This file is obsolete and is kept around for the time being for
+# backward compatibility.  Nobody should rely on the names defined here.
+# Locales should always be specified by their full name.
 
 bokmal		nb_NO.ISO-8859-1
 bokmål		nb_NO.ISO-8859-1

Modified: trunk/libc/localedata/ChangeLog
==============================================================================
--- trunk/libc/localedata/ChangeLog (original)
+++ trunk/libc/localedata/ChangeLog Sun Oct 28 14:23:33 2007
@@ -1,3 +1,8 @@
+2007-10-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5224]
+	* locales/ig_NG: Add missing collating elements and symbols.
+
 2007-10-14  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #4098]

Modified: trunk/libc/localedata/locales/ig_NG
==============================================================================
--- trunk/libc/localedata/locales/ig_NG (original)
+++ trunk/libc/localedata/locales/ig_NG Sun Oct 28 14:23:33 2007
@@ -117,6 +117,11 @@
 collating-element <o_2'> from "<U1ECD><U0301>"
 collating-element <O_2`> from "<U1ECC><U0300>"
 collating-element <o_2`> from "<U1ECD><U0300>"
+collating-symbol  <s-h-ig>
+collating-element <S-H> from "<U0053><U0048>"
+collating-element <S-h> from "<U0053><U0068>"
+collating-element <s-H> from "<U0073><U0048>"
+collating-element <s-h> from "<U0073><U0068>"
 collating-symbol  <ubelowdot>
 collating-element <U_>  from "<U0055><U0323>"
 collating-element <u_>  from "<U0075><U0323>"

Modified: trunk/libc/malloc/arena.c
==============================================================================
--- trunk/libc/malloc/arena.c (original)
+++ trunk/libc/malloc/arena.c Sun Oct 28 14:23:33 2007
@@ -159,6 +159,10 @@
 static void           (*save_free_hook) (__malloc_ptr_t __ptr,
 					 __const __malloc_ptr_t);
 static Void_t*        save_arena;
+
+#ifdef ATFORK_MEM
+ATFORK_MEM;
+#endif
 
 /* Magic value for the thread-specific arena pointer when
    malloc_atfork() is in use.  */

Modified: trunk/libc/manual/libc.texinfo
==============================================================================
--- trunk/libc/manual/libc.texinfo (original)
+++ trunk/libc/manual/libc.texinfo Sun Oct 28 14:23:33 2007
@@ -18,9 +18,9 @@
 @comment %**end of header (This is for running Texinfo on a region.)
 
 @c sold 0.06/1.09, print run out 21may96
-@set EDITION 0.11
-@set VERSION 2.7
-@set UPDATED 2007-09-09
+@set EDITION 0.12
+@set VERSION 2.8
+@set UPDATED 2007-10-27
 @set ISBN 1-882114-55-8
 
 @copying

Modified: trunk/libc/manual/process.texi
==============================================================================
--- trunk/libc/manual/process.texi (original)
+++ trunk/libc/manual/process.texi Sun Oct 28 14:23:33 2007
@@ -277,7 +277,7 @@
 process execute a new program after it has been forked.
 
 To see the effects of @code{exec} from the point of view of the called
-program, @xref{Program Basics}.
+program, see @ref{Program Basics}.
 
 @pindex unistd.h
 The functions in this family differ in how you specify the arguments,

Modified: trunk/libc/manual/socket.texi
==============================================================================
--- trunk/libc/manual/socket.texi (original)
+++ trunk/libc/manual/socket.texi Sun Oct 28 14:23:33 2007
@@ -2070,7 +2070,7 @@
 
 @comment sys/socket.h
 @comment BSD
-@deftypefun int listen (int @var{socket}, unsigned int @var{n})
+@deftypefun int listen (int @var{socket}, int @var{n})
 The @code{listen} function enables the socket @var{socket} to accept
 connections, thus making it a server socket.
 

Modified: trunk/libc/manual/startup.texi
==============================================================================
--- trunk/libc/manual/startup.texi (original)
+++ trunk/libc/manual/startup.texi Sun Oct 28 14:23:33 2007
@@ -31,7 +31,7 @@
 
 A program starts another program with the @code{exec} family of system calls.
 This chapter looks at program startup from the execee's point of view.  To
-see the event from the execor's point of view, @xref{Executing a File}.
+see the event from the execor's point of view, see @ref{Executing a File}.
 
 @menu
 * Program Arguments::           Parsing your program's command-line arguments.
@@ -309,9 +309,9 @@
 
 The value of an environment variable can be accessed with the
 @code{getenv} function.  This is declared in the header file
-@file{stdlib.h}.  All of the following functions can be safely used in
-multi-threaded programs.  It is made sure that concurrent modifications
-to the environment do not lead to errors.
+@file{stdlib.h}.  Modifications of enviroment variables are not
+allowed in Multi-threaded programs.  The @code{getenv} function
+can be safely used in multi-threaded programs
 @pindex stdlib.h
 
 @comment stdlib.h

Modified: trunk/libc/manual/stdio.texi
==============================================================================
--- trunk/libc/manual/stdio.texi (original)
+++ trunk/libc/manual/stdio.texi Sun Oct 28 14:23:33 2007
@@ -3907,7 +3907,7 @@
 know that a function uses a @code{scanf}-style format string.  Then it
 can check the number and types of arguments in each call to the
 function, and warn you when they do not match the format string.
-For details, @xref{Function Attributes, , Declaring Attributes of Functions,
+For details, see @ref{Function Attributes, , Declaring Attributes of Functions,
 gcc.info, Using GNU CC}.
 
 @node EOF and Errors

Modified: trunk/libc/manual/sysinfo.texi
==============================================================================
--- trunk/libc/manual/sysinfo.texi (original)
+++ trunk/libc/manual/sysinfo.texi Sun Oct 28 14:23:33 2007
@@ -78,7 +78,7 @@
 
 In some contexts, the host name is called a ``node name.''
 
-For more information on DNS host naming, @xref{Host Names}.
+For more information on DNS host naming, see @ref{Host Names}.
 
 @pindex hostname
 @pindex hostid

Modified: trunk/libc/manual/syslog.texi
==============================================================================
--- trunk/libc/manual/syslog.texi (original)
+++ trunk/libc/manual/syslog.texi Sun Oct 28 14:23:33 2007
@@ -90,7 +90,7 @@
 @item priority
 This tells how important the content of the message is.  Examples of
 defined priority values are: debug, informational, warning, critical.
-For the complete list, @xref{syslog; vsyslog}.  Except for
+For the complete list, see @ref{syslog; vsyslog}.  Except for
 the fact that the priorities have a defined order, the meaning of each
 of these priorities is entirely determined by the system administrator.
 

Modified: trunk/libc/manual/time.texi
==============================================================================
--- trunk/libc/manual/time.texi (original)
+++ trunk/libc/manual/time.texi Sun Oct 28 14:23:33 2007
@@ -212,7 +212,7 @@
 same value approximately every 72 minutes.
 
 For additional functions to examine a process' use of processor time,
-and to control it, @xref{Resource Usage And Limitation}.
+and to control it, see @ref{Resource Usage And Limitation}.
 
 
 @menu

Modified: trunk/libc/math/libm-test.inc
==============================================================================
--- trunk/libc/math/libm-test.inc (original)
+++ trunk/libc/math/libm-test.inc Sun Oct 28 14:23:33 2007
@@ -487,11 +487,24 @@
   else
     {
       diff = FUNC(fabs) (computed - expected);
-      /* ilogb (0) isn't allowed.  */
-      if (expected == 0.0)
-	ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
-      else
-	ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
+      switch (fpclassify (expected))
+	{
+	case FP_ZERO:
+	  /* ilogb (0) isn't allowed. */
+	  ulp = diff / FUNC(ldexp) (1.0, - MANT_DIG);
+	  break;
+	case FP_NORMAL:
+	  ulp = diff / FUNC(ldexp) (1.0, FUNC(ilogb) (expected) - MANT_DIG);
+	  break;
+	case FP_SUBNORMAL:
+	  ulp = (FUNC(ldexp) (diff, MANT_DIG)
+		 / FUNC(ldexp) (1.0, FUNC(ilogb) (expected)));
+	  break;
+	default:
+	  /* It should never happen. */
+	  abort ();
+	  break;
+	}
       set_max_error (ulp, curr_max_error);
       print_diff = 1;
       if ((exceptions & IGNORE_ZERO_INF_SIGN) == 0

Modified: trunk/libc/nptl/ChangeLog
==============================================================================
--- trunk/libc/nptl/ChangeLog (original)
+++ trunk/libc/nptl/ChangeLog Sun Oct 28 14:23:33 2007
@@ -1,3 +1,29 @@
+2007-10-28  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #5220]
+	* sysdeps/unix/sysv/linux/kernel-posix-timers.h: Declare
+	__active_timer_sigev_thread and __active_timer_sigev_thread_lock.
+	(struct timer): Add next element.
+	* sysdeps/unix/sysv/linux/timer_create.c: For SIGEV_THREAD timers,
+	enqueue timer structure into __active_timer_sigev_thread list.
+	* sysdeps/unix/sysv/linux/timer_delete.c: For SIGEV_THREAD timers,
+	remove timer struct from __active_timer_sigev_thread.
+	* sysdeps/unix/sysv/linux/timer_routines.c (timer_helper_thread):
+	Before using timer structure make sure it is still on the
+	__active_timer_sigev_thread list.  Keep lock until done.
+	Define __active_timer_sigev_thread and
+	__active_timer_sigev_thread_lock.
+
+2007-10-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* sysdeps/pthread/malloc-machine.h: Define ATFORK_MEM.
+	Redefine thread_atfork for use of ATFORK_MEM.
+	* sysdeps/unix/sysv/linux/fork.h: Define __linkin_atfork.
+	* sysdeps/unix/sysv/linux/register-atfork.c (__linkin_atfork): New
+	function.
+	* sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork):
+	Use atomic operation when removing first element of list.
+
 2007-10-17  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/i386/i486/sem_post.S (__old_sem_post): New

Modified: trunk/libc/nptl/sysdeps/pthread/malloc-machine.h
==============================================================================
--- trunk/libc/nptl/sysdeps/pthread/malloc-machine.h (original)
+++ trunk/libc/nptl/sysdeps/pthread/malloc-machine.h Sun Oct 28 14:23:33 2007
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes,
    thread-specific data and parameters for malloc.
-   Copyright (C) 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007 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
@@ -38,13 +38,24 @@
 
 #include <fork.h>
 
+#define ATFORK_MEM static struct fork_handler atfork_mem
+
 #ifdef SHARED
 # define thread_atfork(prepare, parent, child) \
-   __register_atfork (prepare, parent, child, __dso_handle)
+  atfork_mem.prepare_handler = prepare;					      \
+  atfork_mem.parent_handler = parent;					      \
+  atfork_mem.child_handler = child;					      \
+  atfork_mem.dso_handle = __dso_handle;					      \
+  atfork_mem.refcntr = 1;						      \
+  __linkin_atfork (&atfork_mem)
 #else
 # define thread_atfork(prepare, parent, child) \
-   __register_atfork (prepare, parent, child,				      \
-		      &__dso_handle == NULL ? NULL : __dso_handle)
+  atfork_mem.prepare_handler = prepare;					      \
+  atfork_mem.parent_handler = parent;					      \
+  atfork_mem.child_handler = child;					      \
+  atfork_mem.dso_handle = &__dso_handle == NULL ? NULL : __dso_handle;	      \
+  atfork_mem.refcntr = 1;						      \
+  __linkin_atfork (&atfork_mem)
 #endif
 
 /* thread specific data for glibc */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/fork.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/fork.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/fork.h Sun Oct 28 14:23:33 2007
@@ -55,3 +55,6 @@
 			      void (*__child) (void),
 			      void *dso_handle);
 libc_hidden_proto (__register_atfork)
+
+/* Add a new element to the fork list.  */
+extern void __linkin_atfork (struct fork_handler *newp) attribute_hidden;

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h Sun Oct 28 14:23:33 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2003.
 
@@ -35,6 +35,11 @@
 /* TID of the helper thread.  */
 extern pid_t __helper_tid attribute_hidden;
 
+/* List of active SIGEV_THREAD timers.  */
+extern struct timer *__active_timer_sigev_thread attribute_hidden;
+/* Lock for the __active_timer_sigev_thread.  */
+extern pthread_mutex_t __active_timer_sigev_thread_lock attribute_hidden;
+
 
 /* Type of timers in the kernel.  */
 typedef int kernel_timer_t;
@@ -57,4 +62,7 @@
   void (*thrfunc) (sigval_t);
   sigval_t sival;
   pthread_attr_t attr;
+
+  /* Next element in list of active SIGEV_THREAD timers.  */
+  struct timer *next;
 };

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/register-atfork.c
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/register-atfork.c (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/register-atfork.c Sun Oct 28 14:23:33 2007
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <fork.h>
+#include <atomic.h>
 
 
 /* Lock to protect allocation and deallocation of fork handlers.  */
@@ -109,6 +110,17 @@
 libc_hidden_def (__register_atfork)
 
 
+void
+attribute_hidden
+__linkin_atfork (struct fork_handler *newp)
+{
+  do
+    newp->next = __fork_handlers;
+  while (catomic_compare_and_exchange_bool_acq (&__fork_handlers,
+						newp, newp->next) != 0);
+}
+
+
 libc_freeres_fn (free_mem)
 {
   /* Get the lock to not conflict with running forks.  */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c Sun Oct 28 14:23:33 2007
@@ -206,6 +206,13 @@
 				      syscall_clockid, &sev, &newp->ktimerid);
 	      if (! INTERNAL_SYSCALL_ERROR_P (res, err))
 		{
+		  /* Add to the queue of active timers with thread
+		     delivery.  */
+		  pthread_mutex_lock (&__active_timer_sigev_thread_lock);
+		  newp->next = __active_timer_sigev_thread;
+		  __active_timer_sigev_thread = newp;
+		  pthread_mutex_unlock (&__active_timer_sigev_thread_lock);
+
 		  *timerid = (timer_t) newp;
 		  return 0;
 		}

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c Sun Oct 28 14:23:33 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2003.
 
@@ -54,6 +54,27 @@
 
       if (res == 0)
 	{
+	  if (kt->sigev_notify == SIGEV_THREAD)
+	    {
+	      /* Remove the timer from the list.  */
+	      pthread_mutex_lock (&__active_timer_sigev_thread_lock);
+	      if (__active_timer_sigev_thread == kt)
+		__active_timer_sigev_thread = kt->next;
+	      else
+		{
+		  struct timer *prevp = __active_timer_sigev_thread;
+		  while (prevp->next != NULL)
+		    if (prevp->next == kt)
+		      {
+			prevp->next = kt->next;
+			break;
+		      }
+		    else
+		      prevp = prevp->next;
+		}
+	      pthread_mutex_unlock (&__active_timer_sigev_thread_lock);
+	    }
+
 # ifndef __ASSUME_POSIX_TIMERS
 	  /* We know the syscall support is available.  */
 	  __no_posix_timers = 1;

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c Sun Oct 28 14:23:33 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2003.
 
@@ -27,6 +27,12 @@
 #include "kernel-posix-timers.h"
 
 
+/* List of active SIGEV_THREAD timers.  */
+struct timer *__active_timer_sigev_thread;
+/* Lock for the __active_timer_sigev_thread.  */
+pthread_mutex_t __active_timer_sigev_thread_lock = PTHREAD_MUTEX_INITIALIZER;
+
+
 struct thread_start_data
 {
   void (*thrfunc) (sigval_t);
@@ -95,19 +101,36 @@
 	  if (si.si_code == SI_TIMER)
 	    {
 	      struct timer *tk = (struct timer *) si.si_ptr;
-	      struct thread_start_data *td = malloc (sizeof (*td));
-
-	      /* There is not much we can do if the allocation fails.  */
-	      if (td != NULL)
+
+	      /* Check the timer is still used and will not go away
+		 while we are reading the values here.  */
+	      pthread_mutex_lock (&__active_timer_sigev_thread_lock);
+
+	      struct timer *runp = __active_timer_sigev_thread;
+	      while (runp != NULL)
+		if (runp == tk)
+		  break;
+		else
+		  runp = runp->next;
+
+	      if (runp != NULL)
 		{
-		  /* That is the signal we are waiting for.  */
-		  td->thrfunc = tk->thrfunc;
-		  td->sival = tk->sival;
-
-		  pthread_t th;
-		  (void) pthread_create (&th, &tk->attr, timer_sigev_thread,
-					 td);
+		  struct thread_start_data *td = malloc (sizeof (*td));
+
+		  /* There is not much we can do if the allocation fails.  */
+		  if (td != NULL)
+		    {
+		      /* This is the signal we are waiting for.  */
+		      td->thrfunc = tk->thrfunc;
+		      td->sival = tk->sival;
+
+		      pthread_t th;
+		      (void) pthread_create (&th, &tk->attr,
+					     timer_sigev_thread, td);
+		    }
 		}
+
+	      pthread_mutex_unlock (&__active_timer_sigev_thread_lock);
 	    }
 	  else if (si.si_code == SI_TKILL)
 	    /* The thread is canceled.  */

Modified: trunk/libc/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
==============================================================================
--- trunk/libc/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c (original)
+++ trunk/libc/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c Sun Oct 28 14:23:33 2007
@@ -67,10 +67,21 @@
      It's a single linked list so readers are.  */
   do
     {
+    again:
       if (runp->dso_handle == dso_handle)
 	{
 	  if (lastp == NULL)
-	    __fork_handlers = runp->next;
+	    {
+	      /* We have to use an atomic operation here because
+		 __linkin_atfork also uses one.  */
+	      if (catomic_compare_and_exchange_bool_acq (&__fork_handlers,
+							 runp->next, runp)
+		  != 0)
+		{
+		  runp = __fork_handlers;
+		  goto again;
+		}
+	    }
 	  else
 	    lastp->next = runp->next;
 

Modified: trunk/libc/nscd/cache.c
==============================================================================
--- trunk/libc/nscd/cache.c (original)
+++ trunk/libc/nscd/cache.c Sun Oct 28 14:23:33 2007
@@ -229,22 +229,9 @@
       return;
     }
 
-  /* This function can be called from the cleanup thread but also in
-     response to an invalidate command.  Make sure only one thread is
-     running.  When not serving INVALIDATE request, no need for the
-     second to wait around.  */
-  if (fd == -1)
-    {
-      if (pthread_mutex_trylock (&table->prunelock) != 0)
-	/* The work is already being done.  */
-	return;
-    }
-  else
-    pthread_mutex_lock (&table->prunelock);
-
   /* If we check for the modification of the underlying file we invalidate
      the entries also in this case.  */
-  if (table->check_file)
+  if (table->check_file && now != LONG_MAX)
     {
       struct stat64 st;
 
@@ -267,6 +254,21 @@
 	      table->file_mtime = st.st_mtime;
 	    }
 	}
+    }
+
+  /* This function can be called from the cleanup thread but also in
+     response to an invalidate command.  Make sure only one thread is
+     running.  When not serving INVALIDATE request, no need for the
+     second thread to wait around.  */
+  if (__builtin_expect (pthread_mutex_trylock (&table->prunelock) != 0, 0))
+    {
+      /* The work is already being done.  */
+      if (fd == -1)
+	return;
+
+      /* We have to wait until the thread is done and then run again
+	 so that the large NOW value invalidates all entries.  */
+      pthread_mutex_lock (&table->prunelock);
     }
 
   /* We run through the table and find values which are not valid anymore.
@@ -285,6 +287,7 @@
     dbg_log (_("pruning %s cache; time %ld"),
 	     dbnames[table - dbs], (long int) now);
 
+  time_t next_timeout = LONG_MAX;
   do
     {
       ref_t run = table->head->array[--cnt];
@@ -363,14 +366,17 @@
 		}
 	    }
 	  else
-	    assert (dh->usable);
+	    {
+	      assert (dh->usable);
+	      next_timeout = MIN (next_timeout, dh->timeout);
+	    }
 
 	  run = runp->next;
 	}
     }
   while (cnt > 0);
 
-  if (fd != -1)
+  if (__builtin_expect (fd != -1, 0))
     {
       /* Reply to the INVALIDATE initiator that the cache has been
 	 invalidated.  */

Modified: trunk/libc/stdio-common/Makefile
==============================================================================
--- trunk/libc/stdio-common/Makefile (original)
+++ trunk/libc/stdio-common/Makefile Sun Oct 28 14:23:33 2007
@@ -63,7 +63,7 @@
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
       += tst-sscanf tst-swprintf bug15 test-vfprintf
 tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
-      += tst-perror bug19a
+      += tst-perror bug19a bug20
 
 test-srcs = tst-unbputc tst-printf
 

Modified: trunk/libc/stdio-common/vfscanf.c
==============================================================================
--- trunk/libc/stdio-common/vfscanf.c (original)
+++ trunk/libc/stdio-common/vfscanf.c Sun Oct 28 14:23:33 2007
@@ -272,7 +272,7 @@
 	{								    \
 	  CHAR_T *old = wp;						    \
 	  wpmax = (UCHAR_MAX + 1 > 2 * wpmax ? UCHAR_MAX + 1 : 2 * wpmax);  \
-	  wp = (CHAR_T *) alloca (wpmax * sizeof (wchar_t));		    \
+	  wp = (CHAR_T *) alloca (wpmax * sizeof (CHAR_T));		    \
 	  if (old != NULL)						    \
 	    MEMCPY (wp, old, wpsize);					    \
 	}								    \
@@ -2314,7 +2314,7 @@
 
 	  if (__builtin_expect (fc == L'\0', 0))
 	    conv_error ();
-	  wp = (wchar_t *) f - 1;
+	  wchar_t *twend = (wchar_t *) f - 1;
 #else
 	  /* Fill WP with byte flags indexed by character.
 	     We will use this flag map for matching input characters.  */
@@ -2365,9 +2365,10 @@
 
 		  /* Test whether it's in the scanlist.  */
 		  runp = tw;
-		  while (runp < wp)
-		    {
-		      if (runp[0] == L'-' && runp[1] != '\0' && runp + 1 != wp
+		  while (runp < twend)
+		    {
+		      if (runp[0] == L'-' && runp[1] != '\0'
+			  && runp + 1 != twend
 			  && runp != tw
 			  && (unsigned int) runp[-1] <= (unsigned int) runp[1])
 			{
@@ -2405,7 +2406,7 @@
 			}
 		    }
 
-		  if (runp == wp && !not_in)
+		  if (runp == twend && !not_in)
 		    {
 		      ungetc (c, s);
 		      goto out;
@@ -2590,9 +2591,10 @@
 
 		  /* Test whether it's in the scanlist.  */
 		  runp = tw;
-		  while (runp < wp)
-		    {
-		      if (runp[0] == L'-' && runp[1] != '\0' && runp + 1 != wp
+		  while (runp < twend)
+		    {
+		      if (runp[0] == L'-' && runp[1] != '\0'
+			  && runp + 1 != twend
 			  && runp != tw
 			  && (unsigned int) runp[-1] <= (unsigned int) runp[1])
 			{
@@ -2630,7 +2632,7 @@
 			}
 		    }
 
-		  if (runp == wp && !not_in)
+		  if (runp == twend && !not_in)
 		    {
 		      ungetc (c, s);
 		      goto out2;

Modified: trunk/libc/sysdeps/i386/backtrace.c
==============================================================================
--- trunk/libc/sysdeps/i386/backtrace.c (original)
+++ trunk/libc/sysdeps/i386/backtrace.c Sun Oct 28 14:23:33 2007
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 1998, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2000, 2003-2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -36,21 +36,26 @@
 static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
 static _Unwind_Ptr (*unwind_getcfa) (struct _Unwind_Context *);
 static _Unwind_Ptr (*unwind_getgr) (struct _Unwind_Context *, int);
+static void *libgcc_handle;
 
 static void
 init (void)
 {
-  void *handle = __libc_dlopen ("libgcc_s.so.1");
+  libgcc_handle = __libc_dlopen ("libgcc_s.so.1");
 
-  if (handle == NULL)
+  if (libgcc_handle == NULL)
     return;
 
-  unwind_backtrace = __libc_dlsym (handle, "_Unwind_Backtrace");
-  unwind_getip = __libc_dlsym (handle, "_Unwind_GetIP");
-  unwind_getcfa = __libc_dlsym (handle, "_Unwind_GetCFA");
-  unwind_getgr = __libc_dlsym (handle, "_Unwind_GetGR");
+  unwind_backtrace = __libc_dlsym (libgcc_handle, "_Unwind_Backtrace");
+  unwind_getip = __libc_dlsym (libgcc_handle, "_Unwind_GetIP");
+  unwind_getcfa = __libc_dlsym (libgcc_handle, "_Unwind_GetCFA");
+  unwind_getgr = __libc_dlsym (libgcc_handle, "_Unwind_GetGR");
   if (unwind_getip == NULL || unwind_getgr == NULL || unwind_getcfa == NULL)
-    unwind_backtrace = NULL;
+    {
+      unwind_backtrace = NULL;
+      __libc_dlclose (libgcc_handle);
+      libgcc_handle = NULL;
+    }
 }
 #else
 # define unwind_backtrace _Unwind_Backtrace
@@ -142,3 +147,17 @@
 }
 weak_alias (__backtrace, backtrace)
 libc_hidden_def (__backtrace)
+
+
+#ifdef SHARED
+/* Free all resources if necessary.  */
+libc_freeres_fn (free_mem)
+{
+  unwind_backtrace = NULL;
+  if (libgcc_handle != NULL)
+    {
+      __libc_dlclose (libgcc_handle);
+      libgcc_handle = NULL;
+    }
+}
+#endif

Modified: trunk/libc/sysdeps/ia64/backtrace.c
==============================================================================
--- trunk/libc/sysdeps/ia64/backtrace.c (original)
+++ trunk/libc/sysdeps/ia64/backtrace.c Sun Oct 28 14:23:33 2007
@@ -1,5 +1,5 @@
 /* Return backtrace of current program state.
-   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Jakub Jelinek <jakub@xxxxxxxxxx>, 2003.
 
@@ -33,17 +33,18 @@
 #ifdef SHARED
 static _Unwind_Reason_Code (*unwind_backtrace) (_Unwind_Trace_Fn, void *);
 static _Unwind_Ptr (*unwind_getip) (struct _Unwind_Context *);
+static void *libgcc_handle;
 
 static void
 init (void)
 {
-  void *handle = __libc_dlopen ("libgcc_s.so.1");
+  libgcc_handle = __libc_dlopen ("libgcc_s.so.1");
 
-  if (handle == NULL)
+  if (libgcc_handle == NULL)
     return;
 
-  unwind_backtrace = __libc_dlsym (handle, "_Unwind_Backtrace");
-  unwind_getip = __libc_dlsym (handle, "_Unwind_GetIP");
+  unwind_backtrace = __libc_dlsym (libgcc_handle, "_Unwind_Backtrace");
+  unwind_getip = __libc_dlsym (libgcc_handle, "_Unwind_GetIP");
   if (unwind_getip == NULL)
     unwind_backtrace = NULL;
 }
@@ -91,3 +92,17 @@
 }
 weak_alias (__backtrace, backtrace)
 libc_hidden_def (__backtrace)
+
+
+#ifdef SHARED
+/* Free all resources if necessary.  */
+libc_freeres_fn (free_mem)
+{
+  unwind_backtrace = NULL;
+  if (libgcc_handle != NULL)
+    {
+      __libc_dlclose (libgcc_handle);
+      libgcc_handle = NULL;
+    }
+}
+#endif

Modified: trunk/libc/sysdeps/unix/sysv/linux/readahead.c
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/readahead.c (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/readahead.c Sun Oct 28 14:23:33 2007
@@ -1,5 +1,5 @@
 /* Provide kernel hint to read ahead.
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2003, 2004, 2007 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
@@ -30,8 +30,10 @@
 ssize_t
 __readahead (int fd, off64_t offset, size_t count)
 {
-  return INLINE_SYSCALL (readahead, 4, fd, (off_t) (offset >> 32),
-			 (off_t) (offset & 0xffffffff), count);
+  return INLINE_SYSCALL (readahead, 4, fd,
+			 __LONG_LONG_PAIR ((off_t) (offset >> 32),
+					   (off_t) (offset & 0xffffffff)),
+			 count);
 }
 #else
 ssize_t

Modified: trunk/libc/sysdeps/unix/sysv/linux/sys/epoll.h
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/sys/epoll.h (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/sys/epoll.h Sun Oct 28 14:23:33 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2006, 2007 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
@@ -53,6 +53,8 @@
 #define EPOLLERR EPOLLERR
     EPOLLHUP = 0x010,
 #define EPOLLHUP EPOLLHUP
+    EPOLLRDHUP = 0x2000,
+#define EPOLLRDHUP EPOLLRDHUP
     EPOLLONESHOT = (1 << 30),
 #define EPOLLONESHOT EPOLLONESHOT
     EPOLLET = (1 << 31)