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

[commits] r3985 - in /fsf/trunk/libc: ./ crypt/ elf/ localedata/ localedata/locales/ nptl/ nptl/sysdeps/unix/sysv/linux/ stdio-common/



Author: eglibc
Date: Sun Oct 28 14:02:50 2007
New Revision: 3985

Log:
Import glibc-mainline for 2007-10-28

Added:
    fsf/trunk/libc/stdio-common/bug20.c
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/crypt/sha256c-test.c
    fsf/trunk/libc/crypt/sha512c-test.c
    fsf/trunk/libc/elf/dl-load.c
    fsf/trunk/libc/localedata/ChangeLog
    fsf/trunk/libc/localedata/locales/ig_NG
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c
    fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c
    fsf/trunk/libc/stdio-common/Makefile
    fsf/trunk/libc/stdio-common/vfscanf.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Oct 28 14:02:50 2007
@@ -1,3 +1,19 @@
+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]

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

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

Modified: fsf/trunk/libc/elf/dl-load.c
==============================================================================
--- fsf/trunk/libc/elf/dl-load.c (original)
+++ fsf/trunk/libc/elf/dl-load.c Sun Oct 28 14:02:50 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: fsf/trunk/libc/localedata/ChangeLog
==============================================================================
--- fsf/trunk/libc/localedata/ChangeLog (original)
+++ fsf/trunk/libc/localedata/ChangeLog Sun Oct 28 14:02:50 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: fsf/trunk/libc/localedata/locales/ig_NG
==============================================================================
--- fsf/trunk/libc/localedata/locales/ig_NG (original)
+++ fsf/trunk/libc/localedata/locales/ig_NG Sun Oct 28 14:02:50 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: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sun Oct 28 14:02:50 2007
@@ -1,3 +1,19 @@
+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.

Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/kernel-posix-timers.h Sun Oct 28 14:02:50 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: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_create.c Sun Oct 28 14:02:50 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: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_delete.c Sun Oct 28 14:02:50 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: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/timer_routines.c Sun Oct 28 14:02:50 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: fsf/trunk/libc/stdio-common/Makefile
==============================================================================
--- fsf/trunk/libc/stdio-common/Makefile (original)
+++ fsf/trunk/libc/stdio-common/Makefile Sun Oct 28 14:02:50 2007
@@ -57,7 +57,7 @@
 	 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
 	 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
-	 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15
+	 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20
 
 test-srcs = tst-unbputc tst-printf
 

Added: fsf/trunk/libc/stdio-common/bug20.c
==============================================================================
--- fsf/trunk/libc/stdio-common/bug20.c (added)
+++ fsf/trunk/libc/stdio-common/bug20.c Sun Oct 28 14:02:50 2007
@@ -1,0 +1,32 @@
+/* BZ #5225 */
+#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
+
+static int
+do_test (void)
+{
+  wchar_t in[] = L"123,abc,321";
+  /* This is the critical part for this test.  format must be in
+     read-only memory.  */
+  static const wchar_t format[50] = L"%d,%[^,],%d";
+  int out_d1, out_d2;
+  char out_s[50];
+  printf ("in='%ls' format='%ls'\n", in, format);
+  if (swscanf (in, format, &out_d1, out_s, &out_d2) != 3)
+    {
+      puts ("swscanf did not return 3");
+      return 1;
+    }
+  printf ("in='%ls' format='%ls'\n", in, format);
+  printf ("out_d1=%d out_s='%s' out_d2=%d\n", out_d1, out_s, out_d2);
+  if (out_d1 != 123 || strcmp (out_s, "abc") != 0 || out_d2 != 321)
+    {
+      puts ("swscanf did not return the correct values");
+      return 1;
+    }
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"

Modified: fsf/trunk/libc/stdio-common/vfscanf.c
==============================================================================
--- fsf/trunk/libc/stdio-common/vfscanf.c (original)
+++ fsf/trunk/libc/stdio-common/vfscanf.c Sun Oct 28 14:02:50 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;