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

[commits] r7251 - in /fsf/trunk/libc: ./ misc/ nptl/



Author: eglibc
Date: Sun Nov  2 00:03:41 2008
New Revision: 7251

Log:
Import glibc-mainline for 2008-11-02

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/misc/hsearch_r.c
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/pthread_mutex_lock.c
    fsf/trunk/libc/nptl/pthread_mutex_timedlock.c
    fsf/trunk/libc/nptl/pthread_mutex_trylock.c
    fsf/trunk/libc/nptl/pthread_mutex_unlock.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun Nov  2 00:03:41 2008
@@ -1,9 +1,14 @@
+2008-11-01  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #6966]
+	* misc/hsearch_r.c (hsearch_r): Fix secondary hash function.
+
 2008-10-24  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 	    Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* math/tgmath.h (__floating_type): Use __builtin_classify_type in
 	definition for GCC 3.1 and later.
-		
+
 2008-10-31  Jakub Jelinek  <jakub@xxxxxxxxxx>
 
 	* elf/dl-tls.c (__tls_get_addr): After calling _dl_update_slotinfo

Modified: fsf/trunk/libc/misc/hsearch_r.c
==============================================================================
--- fsf/trunk/libc/misc/hsearch_r.c (original)
+++ fsf/trunk/libc/misc/hsearch_r.c Sun Nov  2 00:03:41 2008
@@ -1,4 +1,5 @@
-/* Copyright (C) 1993,1995-1997,2002,2005,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1993,1995-1997,2002,2005,2007,2008
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxxxxxx>, 1993.
 
@@ -154,18 +155,11 @@
     }
 
   /* First hash function: simply take the modul but prevent zero. */
-  hval %= htab->size;
-  if (hval == 0)
-    ++hval;
-
-  /* The first index tried. */
-  idx = hval;
+  idx = hval % htab->size + 1;
 
   if (htab->table[idx].used)
     {
       /* Further action might be required according to the action value. */
-      unsigned hval2;
-
       if (htab->table[idx].used == hval
 	  && strcmp (item.key, htab->table[idx].entry.key) == 0)
 	{
@@ -174,7 +168,8 @@
 	}
 
       /* Second hash function, as suggested in [Knuth] */
-      hval2 = 1 + hval % (htab->size - 2);
+      unsigned int hval2 = 1 + hval % (htab->size - 2);
+      unsigned int first_idx = idx;
 
       do
 	{
@@ -186,7 +181,7 @@
 	    idx -= hval2;
 
 	  /* If we visited all entries leave the loop unsuccessfully.  */
-	  if (idx == hval)
+	  if (idx == first_idx)
 	    break;
 
             /* If entry is found use it. */

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sun Nov  2 00:03:41 2008
@@ -1,3 +1,12 @@
+2008-11-01  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	[BZ #6955]
+	* pthread_mutex_lock.c: Add support for private PI mutexes.
+	* pthread_mutex_timedlock.c: Likewise.
+	* pthread_mutex_trylock.c: Likewise.
+	* pthread_mutex_unlock.c: Likewise.
+	Patch mostly by Ben Jackson <ben@xxxxxxx>.
+
 2008-10-31  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	[BZ #6843]

Modified: fsf/trunk/libc/nptl/pthread_mutex_lock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_lock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_lock.c Sun Nov  2 00:03:41 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -269,9 +269,13 @@
 	  {
 	    /* The mutex is locked.  The kernel will now take care of
 	       everything.  */
+	    int private = (robust
+			   ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+			   : PTHREAD_MUTEX_PSHARED (mutex));
 	    INTERNAL_SYSCALL_DECL (__err);
 	    int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-				      FUTEX_LOCK_PI, 1, 0);
+				      __lll_private_flag (FUTEX_LOCK_PI,
+							  private), 1, 0);
 
 	    if (INTERNAL_SYSCALL_ERROR_P (e, __err)
 		&& (INTERNAL_SYSCALL_ERRNO (e, __err) == ESRCH
@@ -327,7 +331,10 @@
 
 	    INTERNAL_SYSCALL_DECL (__err);
 	    INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-			      FUTEX_UNLOCK_PI, 0, 0);
+			      __lll_private_flag (FUTEX_UNLOCK_PI,
+						  PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+),
+			      0, 0);
 
 	    THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 	    return ENOTRECOVERABLE;

Modified: fsf/trunk/libc/nptl/pthread_mutex_timedlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_timedlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_timedlock.c Sun Nov  2 00:03:41 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002,2003,2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -254,10 +254,15 @@
 	    /* The mutex is locked.  The kernel will now take care of
 	       everything.  The timeout value must be a relative value.
 	       Convert it.  */
+	    int private = (robust
+			   ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+			   : PTHREAD_MUTEX_PSHARED (mutex));
 	    INTERNAL_SYSCALL_DECL (__err);
 
 	    int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-				      FUTEX_LOCK_PI, 1, abstime);
+				      __lll_private_flag (FUTEX_LOCK_PI,
+							  private), 1,
+				      abstime);
 	    if (INTERNAL_SYSCALL_ERROR_P (e, __err))
 	      {
 		if (INTERNAL_SYSCALL_ERRNO (e, __err) == ETIMEDOUT)
@@ -331,7 +336,9 @@
 
 	    INTERNAL_SYSCALL_DECL (__err);
 	    INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-			      FUTEX_UNLOCK_PI, 0, 0);
+			      __lll_private_flag (FUTEX_UNLOCK_PI,
+						  PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+			      0, 0);
 
 	    THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 	    return ENOTRECOVERABLE;

Modified: fsf/trunk/libc/nptl/pthread_mutex_trylock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_trylock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_trylock.c Sun Nov  2 00:03:41 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -231,9 +231,13 @@
 
 	    /* The mutex owner died.  The kernel will now take care of
 	       everything.  */
+	    int private = (robust
+			   ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+			   : PTHREAD_MUTEX_PSHARED (mutex));
 	    INTERNAL_SYSCALL_DECL (__err);
 	    int e = INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-				      FUTEX_TRYLOCK_PI, 0, 0);
+				      __lll_private_flag (FUTEX_TRYLOCK_PI,
+							  private), 0, 0);
 
 	    if (INTERNAL_SYSCALL_ERROR_P (e, __err)
 		&& INTERNAL_SYSCALL_ERRNO (e, __err) == EWOULDBLOCK)
@@ -274,7 +278,9 @@
 
 	    INTERNAL_SYSCALL_DECL (__err);
 	    INTERNAL_SYSCALL (futex, __err, 4, &mutex->__data.__lock,
-			      FUTEX_UNLOCK_PI, 0, 0);
+			      __lll_private_flag (FUTEX_UNLOCK_PI,
+						  PTHREAD_ROBUST_MUTEX_PSHARED (mutex)),
+			      0, 0);
 
 	    THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);
 	    return ENOTRECOVERABLE;

Modified: fsf/trunk/libc/nptl/pthread_mutex_unlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_mutex_unlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_mutex_unlock.c Sun Nov  2 00:03:41 2008
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005-2007, 2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -196,9 +196,13 @@
 						   THREAD_GETMEM (THREAD_SELF,
 								  tid)))
 	{
+	  int robust = mutex->__data.__kind & PTHREAD_MUTEX_ROBUST_NORMAL_NP;
+	  int private = (robust
+			 ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex)
+			 : PTHREAD_MUTEX_PSHARED (mutex));
 	  INTERNAL_SYSCALL_DECL (__err);
 	  INTERNAL_SYSCALL (futex, __err, 2, &mutex->__data.__lock,
-			    FUTEX_UNLOCK_PI);
+			    __lll_private_flag (FUTEX_UNLOCK_PI, private));
 	}
 
       THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL);