[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r2303 - in /fsf/trunk/libc: ./ nptl/ nptl/sysdeps/i386/ nptl/sysdeps/powerpc/ nptl/sysdeps/unix/sysv/linux/ nptl/sysdeps/uni...
- To: commits@xxxxxxxxxx
- Subject: [commits] r2303 - in /fsf/trunk/libc: ./ nptl/ nptl/sysdeps/i386/ nptl/sysdeps/powerpc/ nptl/sysdeps/unix/sysv/linux/ nptl/sysdeps/uni...
- From: eglibc@xxxxxxxxxx
- Date: Sun, 27 May 2007 07:02:15 -0000
Author: eglibc
Date: Sun May 27 00:02:14 2007
New Revision: 2303
Log:
Import glibc-mainline for 2007-05-27
Modified:
fsf/trunk/libc/ChangeLog
fsf/trunk/libc/nptl/ChangeLog
fsf/trunk/libc/nptl/allocatestack.c
fsf/trunk/libc/nptl/descr.h
fsf/trunk/libc/nptl/init.c
fsf/trunk/libc/nptl/pthreadP.h
fsf/trunk/libc/nptl/pthread_barrier_init.c
fsf/trunk/libc/nptl/pthread_rwlock_rdlock.c
fsf/trunk/libc/nptl/pthread_rwlock_timedrdlock.c
fsf/trunk/libc/nptl/pthread_rwlock_tryrdlock.c
fsf/trunk/libc/nptl/sysdeps/i386/tls.h
fsf/trunk/libc/nptl/sysdeps/powerpc/tcb-offsets.sym
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/internaltypes.h
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_wait.c
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c
Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sun May 27 00:02:14 2007
@@ -1,3 +1,7 @@
+2007-05-26 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * sysdeps/unix/sysv/linux/powerpc/libc-start.c: Include <sysdep.h>.
+
2007-05-25 Jakub Jelinek <jakub@xxxxxxxxxx>
* io/bits/fcntl2.h (__open_2): Add nonnull attribute.
Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sun May 27 00:02:14 2007
@@ -1,3 +1,34 @@
+2007-05-26 Ulrich Drepper <drepper@xxxxxxxxxx>
+
+ * pthreadP.h (PTHREAD_RWLOCK_PREFER_READER_P): Define.
+ * pthread_rwlock_rdlock.c: Use PTHREAD_RWLOCK_PREFER_READER_P.
+ * pthread_rwlock_timedrdlock.c: Likewise.
+ * pthread_rwlock_tryrdlock.c: Likewise.
+
+ * sysdeps/unix/sysv/linux/x86_64/sem_trywait.S (sem_trywait): Tiny
+ optimization.
+
+ * sysdeps/unix/sysv/linux/sem_wait.c: Add missing break.
+ * sysdeps/unix/sysv/linux/sem_timedwait.c: Removed left-over
+ duplication of __sem_wait_cleanup.
+
+ * allocatestack.c: Revert last change.
+ * init.c: Likewise.
+ * sysdeps/i386/tls.h: Likewise.
+ * sysdeps/x86_64/tls.h: Likewise.
+ * descr.h [TLS_DTV_AT_TP] (struct pthread): Add private_futex field to
+ header structure.
+ * sysdeps/powerpc/tcb-offsets.sym: Add PRIVATE_FUTEX_OFFSET.
+
+ * sysdeps/unix/sysv/linux/internaltypes.h (struct pthread_barrier):
+ Add private field.
+ * sysdeps/unix/sysv/linux/lowlevelbarrier.sym: Add PRIVATE definition.
+ * pthread_barrier_init.c: Set private flag if pshared and private
+ futexes are supported.
+ * sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S: Use
+ private field in futex command setup.
+ * sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S: Likewise.
+
2007-05-25 Ulrich Drepper <drepper@xxxxxxxxxx>
* sysdeps/unix/sysv/linux/i386/i486/sem_post.S: Add private futex
Modified: fsf/trunk/libc/nptl/allocatestack.c
==============================================================================
--- fsf/trunk/libc/nptl/allocatestack.c (original)
+++ fsf/trunk/libc/nptl/allocatestack.c Sun May 27 00:02:14 2007
@@ -376,9 +376,10 @@
__pthread_multiple_threads = *__libc_multiple_threads_ptr = 1;
#endif
-#ifdef THREAD_COPY_PRIVATE_FUTEX
+#ifndef __ASSUME_PRIVATE_FUTEX
/* The thread must know when private futexes are supported. */
- THREAD_COPY_PRIVATE_FUTEX (pd);
+ pd->header.private_futex = THREAD_GETMEM (THREAD_SELF,
+ header.private_futex);
#endif
#ifdef NEED_DL_SYSINFO
Modified: fsf/trunk/libc/nptl/descr.h
==============================================================================
--- fsf/trunk/libc/nptl/descr.h (original)
+++ fsf/trunk/libc/nptl/descr.h Sun May 27 00:02:14 2007
@@ -37,6 +37,7 @@
#endif
#define __need_res_state
#include <resolv.h>
+#include <kernel-features.h>
#ifndef TCB_ALIGNMENT
# define TCB_ALIGNMENT sizeof (double)
@@ -131,6 +132,9 @@
struct
{
int multiple_threads;
+# ifndef __ASSUME_PRIVATE_FUTEX
+ int private_futex;
+# endif
} header;
#endif
Modified: fsf/trunk/libc/nptl/init.c
==============================================================================
--- fsf/trunk/libc/nptl/init.c (original)
+++ fsf/trunk/libc/nptl/init.c Sun May 27 00:02:14 2007
@@ -284,7 +284,7 @@
res = INTERNAL_SYSCALL (futex, err, 3, &word,
FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1);
if (!INTERNAL_SYSCALL_ERROR_P (res, err))
- THREAD_SET_PRIVATE_FUTEX (FUTEX_PRIVATE_FLAG);
+ pd->header.private_futex = FUTEX_PRIVATE_FLAG;
}
#endif
Modified: fsf/trunk/libc/nptl/pthreadP.h
==============================================================================
--- fsf/trunk/libc/nptl/pthreadP.h (original)
+++ fsf/trunk/libc/nptl/pthreadP.h Sun May 27 00:02:14 2007
@@ -116,6 +116,11 @@
#define PTHREAD_MUTEXATTR_FLAG_BITS \
(PTHREAD_MUTEXATTR_FLAG_ROBUST | PTHREAD_MUTEXATTR_FLAG_PSHARED \
| PTHREAD_MUTEXATTR_PROTOCOL_MASK | PTHREAD_MUTEXATTR_PRIO_CEILING_MASK)
+
+
+/* Check whether rwlock prefers readers. */
+#define PTHREAD_RWLOCK_PREFER_READER_P(rwlock) \
+ ((rwlock)->__data.__flags == 0)
/* Bits used in robust mutex implementation. */
Modified: fsf/trunk/libc/nptl/pthread_barrier_init.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_barrier_init.c (original)
+++ fsf/trunk/libc/nptl/pthread_barrier_init.c Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -20,6 +20,13 @@
#include <errno.h>
#include "pthreadP.h"
#include <lowlevellock.h>
+#include <kernel-features.h>
+
+
+static const struct pthread_barrierattr default_attr =
+ {
+ .pshared = PTHREAD_PROCESS_PRIVATE
+ };
int
@@ -33,17 +40,15 @@
if (__builtin_expect (count == 0, 0))
return EINVAL;
- if (attr != NULL)
- {
- struct pthread_barrierattr *iattr;
+ struct pthread_barrierattr *iattr
+ = (attr != NULL
+ ? iattr = (struct pthread_barrierattr *) attr
+ : &default_attr);
- iattr = (struct pthread_barrierattr *) attr;
-
- if (iattr->pshared != PTHREAD_PROCESS_PRIVATE
- && __builtin_expect (iattr->pshared != PTHREAD_PROCESS_SHARED, 0))
- /* Invalid attribute. */
- return EINVAL;
- }
+ if (iattr->pshared != PTHREAD_PROCESS_PRIVATE
+ && __builtin_expect (iattr->pshared != PTHREAD_PROCESS_SHARED, 0))
+ /* Invalid attribute. */
+ return EINVAL;
ibarrier = (struct pthread_barrier *) barrier;
@@ -53,5 +58,14 @@
ibarrier->init_count = count;
ibarrier->curr_event = 0;
+#ifdef __ASSUME_PRIVATE_FUTEX
+ ibarrier->private = (iattr->pshared != PTHREAD_PROCESS_PRIVATE
+ ? 0 : FUTEX_PRIVATE_FLAG);
+#else
+ ibarrier->private = (iattr->pshared != PTHREAD_PROCESS_PRIVATE
+ ? 0 : THREAD_GETMEM (THREAD_SELF,
+ header.private_futex));
+#endif
+
return 0;
}
Modified: fsf/trunk/libc/nptl/pthread_rwlock_rdlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_rwlock_rdlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_rwlock_rdlock.c Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@xxxxxxxxxx>, 2003.
@@ -40,7 +40,7 @@
if (rwlock->__data.__writer == 0
/* ...and if either no writer is waiting or we prefer readers. */
&& (!rwlock->__data.__nr_writers_queued
- || rwlock->__data.__flags == 0))
+ || PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
/* Increment the reader counter. Avoid overflow. */
if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
Modified: fsf/trunk/libc/nptl/pthread_rwlock_timedrdlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_rwlock_timedrdlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_rwlock_timedrdlock.c Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2003, 2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Martin Schwidefsky <schwidefsky@xxxxxxxxxx>, 2003.
@@ -43,7 +43,7 @@
if (rwlock->__data.__writer == 0
/* ...and if either no writer is waiting or we prefer readers. */
&& (!rwlock->__data.__nr_writers_queued
- || rwlock->__data.__flags == 0))
+ || PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
/* Increment the reader counter. Avoid overflow. */
if (++rwlock->__data.__nr_readers == 0)
Modified: fsf/trunk/libc/nptl/pthread_rwlock_tryrdlock.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_rwlock_tryrdlock.c (original)
+++ fsf/trunk/libc/nptl/pthread_rwlock_tryrdlock.c Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -32,7 +32,7 @@
if (rwlock->__data.__writer == 0
&& (rwlock->__data.__nr_writers_queued == 0
- || rwlock->__data.__flags == 0))
+ || PTHREAD_RWLOCK_PREFER_READER_P (rwlock)))
{
if (__builtin_expect (++rwlock->__data.__nr_readers == 0, 0))
{
Modified: fsf/trunk/libc/nptl/sysdeps/i386/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/i386/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/i386/tls.h Sun May 27 00:02:14 2007
@@ -458,16 +458,6 @@
#define THREAD_GSCOPE_WAIT() \
GL(dl_wait_lookup_done) ()
-
-#ifndef __ASSUME_PRIVATE_FUTEX
-# define THREAD_SET_PRIVATE_FUTEX(value) \
- THREAD_SETMEM (THREAD_SELF, header.private_futex, value)
-# define THREAD_COPY_PRIVATE_FUTEX(descr) \
- ((descr)->header.private_futex \
- = THREAD_GETMEM (THREAD_SELF, header.private_futex))
-#endif
-
-
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
Modified: fsf/trunk/libc/nptl/sysdeps/powerpc/tcb-offsets.sym
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/powerpc/tcb-offsets.sym (original)
+++ fsf/trunk/libc/nptl/sysdeps/powerpc/tcb-offsets.sym Sun May 27 00:02:14 2007
@@ -15,3 +15,4 @@
PID thread_offsetof (pid)
TID thread_offsetof (tid)
POINTER_GUARD (offsetof (tcbhead_t, pointer_guard) - TLS_TCB_OFFSET - sizeof (tcbhead_t))
+PRIVATE_FUTEX_OFFSET thread_offsetof (header.private_futex)
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_barrier_wait.S Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* 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.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -69,7 +69,13 @@
/* Wait for the remaining threads. The call will return immediately
if the CURR_EVENT memory has meanwhile been changed. */
-7: xorl %ecx, %ecx /* movl $FUTEX_WAIT, %ecx */
+7:
+#if FUTEX_WAIT == 0
+ movl PRIVATE(%ebx), %ecx
+#else
+ movl $FUTEX_WAIT, %ecx
+ orl PRIVATE(%ebx), %ecx
+#endif
xorl %esi, %esi
8: movl $SYS_futex, %eax
ENTER_KERNEL
@@ -120,6 +126,7 @@
so 0x7fffffff is the highest value. */
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
+ orl PRIVATE(%ebx), %ecx
movl $SYS_futex, %eax
ENTER_KERNEL
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/internaltypes.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/internaltypes.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/internaltypes.h Sun May 27 00:02:14 2007
@@ -96,6 +96,7 @@
int lock;
unsigned int left;
unsigned int init_count;
+ int private;
};
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/lowlevelbarrier.sym Sun May 27 00:02:14 2007
@@ -9,3 +9,4 @@
MUTEX offsetof (struct pthread_barrier, lock)
LEFT offsetof (struct pthread_barrier, left)
INIT_COUNT offsetof (struct pthread_barrier, init_count)
+PRIVATE offsetof (struct pthread_barrier, private)
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_timedwait.c Sun May 27 00:02:14 2007
@@ -29,16 +29,6 @@
extern void __sem_wait_cleanup (void *arg) attribute_hidden;
-
-
-void
-attribute_hidden
-__sem_wait_cleanup (void *arg)
-{
- struct new_sem *isem = (struct new_sem *) arg;
-
- atomic_decrement (&isem->nwaiters);
-}
int
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_wait.c
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_wait.c (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/sem_wait.c Sun May 27 00:02:14 2007
@@ -65,6 +65,7 @@
{
__set_errno (-err);
err = -1;
+ break;
}
if (atomic_decrement_if_positive (&isem->value) > 0)
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_barrier_wait.S Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -65,9 +65,10 @@
if the CURR_EVENT memory has meanwhile been changed. */
7:
#if FUTEX_WAIT == 0
- xorl %esi, %esi
+ movl PRIVATE(%rdi), %esi
#else
movl $FUTEX_WAIT, %esi
+ orl PRIVATE(%rdi), %esi
#endif
xorq %r10, %r10
8: movl $SYS_futex, %eax
@@ -116,6 +117,7 @@
so 0x7fffffff is the highest value. */
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %esi
+ orl PRIVATE(%rdi), %esi
movl $SYS_futex, %eax
syscall
Modified: fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S (original)
+++ fsf/trunk/libc/nptl/sysdeps/unix/sysv/linux/x86_64/sem_trywait.S Sun May 27 00:02:14 2007
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
@@ -37,7 +37,7 @@
2: testl %eax, %eax
jz 1f
- leaq -1(%rax), %rdx
+ leal -1(%rax), %edx
LOCK
cmpxchgl %edx, (%rdi)
jne 2b
Modified: fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h
==============================================================================
--- fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h (original)
+++ fsf/trunk/libc/nptl/sysdeps/x86_64/tls.h Sun May 27 00:02:14 2007
@@ -364,14 +364,6 @@
#define THREAD_GSCOPE_WAIT() \
GL(dl_wait_lookup_done) ()
-#ifndef __ASSUME_PRIVATE_FUTEX
-# define THREAD_SET_PRIVATE_FUTEX(value) \
- THREAD_SETMEM (THREAD_SELF, header.private_futex, value)
-# define THREAD_COPY_PRIVATE_FUTEX(descr) \
- ((descr)->header.private_futex \
- = THREAD_GETMEM (THREAD_SELF, header.private_futex))
-#endif
-
#endif /* __ASSEMBLER__ */
#endif /* tls.h */
Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/libc-start.c Sun May 27 00:02:14 2007
@@ -20,6 +20,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <ldsodefs.h>
+#include <sysdep.h>
#include <bp-start.h>
#include <bp-sym.h>