--- /dev/null
+diff -Nur glibc-2.3.2/linuxthreads.old/alloca_cutoff.c glibc-2.3.2/linuxthreads/alloca_cutoff.c
+--- glibc-2.3.2/linuxthreads.old/alloca_cutoff.c 2002-12-28 05:06:33.000000000 -0500
++++ glibc-2.3.2/linuxthreads/alloca_cutoff.c 2003-03-31 19:52:40.000000000 -0500
+@@ -1,5 +1,5 @@
+ /* Determine whether block of given size can be allocated on the stack or not.
+- Copyright (C) 2002 Free Software Foundation, Inc.
++ Copyright (C) 2002, 2003 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
+@@ -20,6 +20,7 @@
+ #include <alloca.h>
+ #include <stdlib.h>
+ #include <sys/param.h>
++#include "internals.h"
+ #include <sysdep-cancel.h>
+
+ int
+diff -Nur glibc-2.3.2/linuxthreads.old/ChangeLog glibc-2.3.2/linuxthreads/ChangeLog
+--- glibc-2.3.2/linuxthreads.old/ChangeLog 2003-02-27 17:40:10.000000000 -0500
++++ glibc-2.3.2/linuxthreads/ChangeLog 2003-04-02 04:20:07.000000000 -0500
+@@ -1,4 +1,127 @@
+-2003-02-27 Roland McGrath <roland@redhat.com>
++2003-04-02 Jakub Jelinek <jakub@redhat.com>
++
++ * Makefile (libpthread-routines): Add pthread_atfork.
++ (libpthread-static-only-routines): Add pthread_atfork.
++
++2003-04-01 Jakub Jelinek <jakub@redhat.com>
++
++ * pthread.c (__pthread_wait_for_restart_signal): Use
++ __pthread_sigsuspend instead of sigsuspend.
++ * internals.h (__pthread_sigsuspend): New prototype.
++ * Makefile (libpthread-routines): Add pt-sigsuspend.
++ (tests): Add tst-cancel7.
++ * sysdeps/unix/sysv/linux/pt-sigsuspend.c: New file.
++ * sysdeps/unix/sysv/linux/alpha/pt-sigsuspend.S: New file.
++ * sysdeps/unix/sysv/linux/ia64/pt-sigsuspend.c: New file.
++ * sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c: New file.
++ * sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c: New file.
++ * sysdeps/unix/sysv/linux/x86_64/pt-sigsuspend.c: New file.
++ * tst-cancel7.c: New test.
++
++2003-03-31 Alexandre Oliva <aoliva@redhat.com>
++
++ * alloca_cutoff.c: Include internals.h.
++ * sysdeps/pthread/errno-loc.c: Include linuxthreads/internals.h.
++ * sysdeps/pthread/herrno-loc.c: Likewise.
++ * sysdeps/pthread/res-state.c: Likewise.
++
++2003-03-25 Ulrich Drepper <drepper@redhat.com>
++
++ * sysdeps/pthread/bits/typesizes.h: New file.
++ * sysdeps/unix/sysv/linux/alpha/bits/typesizes.h: New file.
++ * sysdeps/unix/sysv/linux/sparc/bits/typesizes.h: New file.
++
++2003-03-24 Daniel Jacobowitz <drow@mvista.com>
++
++ * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
++ (DOARGS_5, DOARGS_6, DOARGS_7): Rewritten.
++
++2003-03-22 Jakub Jelinek <jakub@redhat.com>
++
++ * sysdeps/unix/sysv/linux/fork.c (__fork): Add libc_hidden_def.
++
++2003-03-21 Daniel Jacobowitz <drow@mvista.com>
++
++ * sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
++ (SINGLE_THREAD_P_PIC): Use "reg" instead of "lr".
++
++2003-03-21 Jakub Jelinek <jakub@redhat.com>
++
++ * sysdeps/i386/tls.h [__ASSUME_SET_THREAD_AREA_SYSCALL]
++ (TLS_SETUP_GS_SEGMENT): Fix a typo.
++
++2003-03-19 Ulrich Drepper <drepper@redhat.com>
++
++ * sysdeps/pthread/Makefile: Fix cut&paste error.
++
++2003-03-18 Roland McGrath <roland@redhat.com>
++
++ * Versions (libpthread: GLIBC_2.2): Remove
++ pthread_barrierattr_getpshared, never really existed.
++ (libpthread: GLIBC_2.0): Move __pthread_initialize to ...
++ (libpthread: GLIBC_PRIVATE): ... here.
++
++2003-03-14 Jakub Jelinek <jakub@redhat.com>
++
++ * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: New file.
++ * sysdeps/unix/sysv/linux/sparc/Makefile ($(objpfx)specs): Use full
++ path for crt[in].o.
++
++2003-03-14 Alexandre Oliva <aoliva@redhat.com>
++
++ * sysdeps/mips/pspinlock.c (__pthread_spin_lock): Don't .set
++ mips2 on new abi.
++ * sysdeps/mips/pt-machine.h (__compare_and_swap): Likewise.
++ Handle 64-bit longs on n64.
++
++2003-03-07 Jakub Jelinek <jakub@redhat.com>
++
++ * sysdeps/ia64/pspinlock.c (__pthread_spin_lock,
++ __pthread_spin_trylock): Rewritten.
++
++2003-03-06 Ulrich Drepper <drepper@redhat.com>
++
++ * tst-cancel4.c (tf_sleep): Lower sleep time a bit to not upset
++ recent kernels.
++
++2003-03-02 Ulrich Drepper <drepper@redhat.com>
++
++ * sysdeps/pthread/timer_create.c (timer_create): Return correct
++ error for CPU clocks.
++
++ * sysdeps/unix/sysv/linux/bits/posix_opt.h: Define
++ _POSIX_MONOTONIC_CLOCK.
++ * sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Likewise.
++
++2003-03-01 Roland McGrath <roland@redhat.com>
++
++ * sysdeps/powerpc/powerpc64/pt-machine.h
++ (THREAD_GETMEM, THREAD_GETMEM_NC, THREAD_SETMEM, THREAD_SETMEM_NC):
++ New macros.
++ * sysdeps/powerpc/tls.h: Don't define those here.
++
++ * sysdeps/powerpc/tls.h [! USE_TLS && !__powerpc64__]: Define
++ tcbhead_t with multiple_threads member.
++ [USE_TLS] (tcbhead_t): Define minimal one-word version.
++ [USE_TLS && !__powerpc64__] (TLS_MULTIPLE_THREADS_IN_TCB): Define.
++ * sysdeps/powerpc/tcb-offsets.sym [USE_TLS]: Use tls.h macros to
++ derive thread register offset of p_multiple_threads member.
++
++ * descr.h (struct _pthread_descr_struct) [!USE_TLS || !TLS_DTV_AT_TP]:
++ Conditionalize p_header member on this.
++ [TLS_MULTIPLE_THREADS_IN_TCB]: Add p_multiple_threads alternatively.
++ * sysdeps/ia64/tls.h [USE_TLS] (TLS_MULTIPLE_THREADS_IN_TCB): Define.
++ * sysdeps/sh/tls.h: Likewise.
++ * sysdeps/ia64/tcb-offsets.sym [USE_TLS]: Use p_multiple_threads.
++ * sysdeps/sh/tcb-offsets.sym: Likewise.
++ * sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
++ (SINGLE_THREAD_P): Likewise.
++ * sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
++ (SINGLE_THREAD_P): Likewise.
++ * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
++ (SINGLE_THREAD_P): Likewise.
++ * pthread.c (__pthread_initialize_manager): Likewise.
++ * manager.c (pthread_handle_create): Likewise.
+
+ * sysdeps/powerpc/tls.h [HAVE_TLS_SUPPORT]: Define USE_TLS and all
+ related macros.
+diff -Nur glibc-2.3.2/linuxthreads.old/descr.h glibc-2.3.2/linuxthreads/descr.h
+--- glibc-2.3.2/linuxthreads.old/descr.h 2002-12-28 05:06:33.000000000 -0500
++++ glibc-2.3.2/linuxthreads/descr.h 2003-03-02 06:44:20.000000000 -0500
+@@ -23,6 +23,7 @@
+ #include <stdint.h>
+ #include <sys/types.h>
+ #include <hp-timing.h>
++#include <tls.h>
+
+ /* Fast thread-specific data internal to libc. */
+ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
+@@ -106,11 +107,14 @@
+
+ union dtv;
+
+-
+-struct _pthread_descr_struct {
+- /* XXX Remove this union for IA-64 style TLS module */
+- union {
+- struct {
++struct _pthread_descr_struct
++{
++#if !defined USE_TLS || !TLS_DTV_AT_TP
++ /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads. */
++ union
++ {
++ struct
++ {
+ void *tcb; /* Pointer to the TCB. This is not always
+ the address of this thread descriptor. */
+ union dtv *dtvp;
+@@ -122,6 +126,11 @@
+ } data;
+ void *__padding[16];
+ } p_header;
++# define p_multiple_threads p_header.data.multiple_threads
++#elif TLS_MULTIPLE_THREADS_IN_TCB
++ int p_multiple_threads;
++#endif
++
+ pthread_descr p_nextlive, p_prevlive;
+ /* Double chaining of active threads */
+ pthread_descr p_nextwaiting; /* Next element in the queue holding the thr */
+diff -Nur glibc-2.3.2/linuxthreads.old/internals.h glibc-2.3.2/linuxthreads/internals.h
+--- glibc-2.3.2/linuxthreads.old/internals.h 2003-01-06 19:02:26.000000000 -0500
++++ glibc-2.3.2/linuxthreads/internals.h 2003-04-01 19:10:44.000000000 -0500
+@@ -377,6 +377,8 @@
+
+ extern void __pthread_wait_for_restart_signal(pthread_descr self);
+
++extern void __pthread_sigsuspend (const sigset_t *mask) attribute_hidden;
++
+ extern int __pthread_yield (void);
+
+ extern int __pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock,
+diff -Nur glibc-2.3.2/linuxthreads.old/Makefile glibc-2.3.2/linuxthreads/Makefile
+--- glibc-2.3.2/linuxthreads.old/Makefile 2003-02-21 20:01:16.000000000 -0500
++++ glibc-2.3.2/linuxthreads/Makefile 2003-04-02 04:19:59.000000000 -0500
+@@ -36,8 +36,8 @@
+ install-lib-ldscripts := libpthread.so
+
+ libpthread-routines := attr cancel condvar join manager mutex ptfork \
+- ptlongjmp pthread signals specific errno lockfile \
+- semaphore spinlock rwlock pt-machine \
++ ptlongjmp pthread pt-sigsuspend signals specific errno \
++ lockfile semaphore spinlock rwlock pt-machine \
+ oldsemaphore events getcpuclockid pspinlock barrier \
+ ptclock_gettime ptclock_settime sighandler \
+ pthandles libc-tls-loc pt-allocrtsig \
+@@ -47,11 +47,12 @@
+ ptw-lseek64 ptw-llseek ptw-msync ptw-nanosleep \
+ ptw-open ptw-open64 ptw-pause ptw-pread ptw-pread64 \
+ ptw-pwrite ptw-pwrite64 ptw-tcdrain ptw-wait \
+- ptw-waitpid pt-system old_pthread_atfork
++ ptw-waitpid pt-system old_pthread_atfork pthread_atfork
+ # Don't generate deps for calls with no sources. See sysdeps/unix/Makefile.
+ omit-deps = $(unix-syscalls:%=ptw-%)
+
+ libpthread-shared-only-routines = pt-allocrtsig
++libpthread-static-only-routines = pthread_atfork
+
+ libpthread-nonshared = pthread_atfork
+
+@@ -89,7 +90,7 @@
+ tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \
+ ex17 ex18 tst-cancel tst-context bug-sleep \
+ tst-cancel1 tst-cancel2 tst-cancel3 tst-cancel4 tst-cancel5 \
+- tst-cancel6 tst-popen tst-popen2
++ tst-cancel6 tst-cancel7 tst-popen tst-popen2
+ test-srcs = tst-signal
+ # These tests are linked with libc before libpthread
+ tests-reverse += tst-cancel5
+diff -Nur glibc-2.3.2/linuxthreads.old/manager.c glibc-2.3.2/linuxthreads/manager.c
+--- glibc-2.3.2/linuxthreads.old/manager.c 2003-01-12 03:37:35.000000000 -0500
++++ glibc-2.3.2/linuxthreads/manager.c 2003-03-02 06:44:20.000000000 -0500
+@@ -638,13 +638,13 @@
+ new_thread_id = sseg + pthread_threads_counter;
+ /* Initialize the thread descriptor. Elements which have to be
+ initialized to zero already have this value. */
+-#if defined USE_TLS && TLS_DTV_AT_TP
+- new_thread->p_header.data.tcb = new_thread + 1;
+-#else
++#if !defined USE_TLS || !TLS_DTV_AT_TP
+ new_thread->p_header.data.tcb = new_thread;
+-#endif
+ new_thread->p_header.data.self = new_thread;
+- new_thread->p_header.data.multiple_threads = 1;
++#endif
++#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
++ new_thread->p_multiple_threads = 1;
++#endif
+ new_thread->p_tid = new_thread_id;
+ new_thread->p_lock = &(__pthread_handles[sseg].h_lock);
+ new_thread->p_cancelstate = PTHREAD_CANCEL_ENABLE;
+diff -Nur glibc-2.3.2/linuxthreads.old/pthread.c glibc-2.3.2/linuxthreads/pthread.c
+--- glibc-2.3.2/linuxthreads.old/pthread.c 2003-01-16 13:14:41.000000000 -0500
++++ glibc-2.3.2/linuxthreads/pthread.c 2003-04-01 19:10:44.000000000 -0500
+@@ -566,8 +566,10 @@
+ #endif
+
+ __pthread_multiple_threads = 1;
+- __pthread_main_thread->p_header.data.multiple_threads = 1;
+- * __libc_multiple_threads_ptr = 1;
++#if TLS_MULTIPLE_THREADS_IN_TCB || !defined USE_TLS || !TLS_DTV_AT_TP
++ __pthread_main_thread->p_multiple_threads = 1;
++#endif
++ *__libc_multiple_threads_ptr = 1;
+
+ #ifndef HAVE_Z_NODELETE
+ if (__builtin_expect (&__dso_handle != NULL, 1))
+@@ -611,9 +613,13 @@
+ __pthread_handles[1].h_descr = manager_thread = mgr;
+
+ /* Initialize the descriptor. */
++#if !defined USE_TLS || !TLS_DTV_AT_TP
+ mgr->p_header.data.tcb = tcbp;
+ mgr->p_header.data.self = mgr;
+ mgr->p_header.data.multiple_threads = 1;
++#elif TLS_MULTIPLE_THREADS_IN_TCB
++ mgr->p_multiple_threads = 1;
++#endif
+ mgr->p_lock = &__pthread_handles[1].h_lock;
+ # ifndef HAVE___THREAD
+ mgr->p_errnop = &mgr->p_errno;
+@@ -1138,7 +1144,8 @@
+ sigdelset(&mask, __pthread_sig_restart); /* Unblock the restart signal */
+ THREAD_SETMEM(self, p_signal, 0);
+ do {
+- sigsuspend(&mask); /* Wait for signal */
++ __pthread_sigsuspend(&mask); /* Wait for signal. Must not be a
++ cancellation point. */
+ } while (THREAD_GETMEM(self, p_signal) !=__pthread_sig_restart);
+
+ READ_MEMORY_BARRIER(); /* See comment in __pthread_restart_new */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/i386/tls.h glibc-2.3.2/linuxthreads/sysdeps/i386/tls.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/i386/tls.h 2003-02-25 19:46:32.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/i386/tls.h 2003-03-21 15:37:16.000000000 -0500
+@@ -171,7 +171,7 @@
+
+ # ifdef __ASSUME_SET_THREAD_AREA_SYSCALL
+ # define TLS_SETUP_GS_SEGMENT(descr, secondcall) \
+- (TLS_DO_SET_THREAD_AREA (descr, firstcall) \
++ (TLS_DO_SET_THREAD_AREA (descr, secondcall) \
+ ? "set_thread_area failed when setting up thread-local storage" : NULL)
+ # elif defined __NR_set_thread_area
+ # define TLS_SETUP_GS_SEGMENT(descr, secondcall) \
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/ia64/pspinlock.c glibc-2.3.2/linuxthreads/sysdeps/ia64/pspinlock.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/ia64/pspinlock.c 2002-08-27 00:52:35.000000000 -0400
++++ glibc-2.3.2/linuxthreads/sysdeps/ia64/pspinlock.c 2003-03-07 17:22:38.000000000 -0500
+@@ -1,5 +1,5 @@
+ /* POSIX spinlock implementation. ia64 version.
+- Copyright (C) 2000 Free Software Foundation, Inc.
++ Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jes Sorensen <jes@linuxcare.com>
+
+@@ -21,6 +21,7 @@
+ #include <errno.h>
+ #include <pthread.h>
+ #include "internals.h"
++#include <ia64intrin.h>
+
+ /* This implementation is inspired by the implementation used in the
+ Linux kernel. */
+@@ -28,21 +29,15 @@
+ int
+ __pthread_spin_lock (pthread_spinlock_t *lock)
+ {
+- asm volatile
+- ("mov ar.ccv = r0\n\t"
+- "mov r3 = 1\n\t"
+- ";;\n"
+- "1:\n\t"
+- "ld4 r2 = %0\n\t"
+- ";;\n\t"
+- "cmp4.eq p0, p7 = r0, r2\n\t"
+- "(p7) br.cond.spnt.few 1b \n\t"
+- "cmpxchg4.acq r2 = %0, r3, ar.ccv\n\t"
+- ";;\n\t"
+- "cmp4.eq p0, p7 = r0, r2\n\t"
+- "(p7) br.cond.spnt.few 1b\n\t"
+- ";;\n"
+- :: "m" (lock) : "r2", "r3", "p7", "memory");
++ int *p = (int *) lock;
++
++ while (__builtin_expect (__sync_val_compare_and_swap_si (p, 0, 1), 0))
++ {
++ /* Spin without using the atomic instruction. */
++ do
++ __asm __volatile ("" : : : "memory");
++ while (*p);
++ }
+ return 0;
+ }
+ weak_alias (__pthread_spin_lock, pthread_spin_lock)
+@@ -51,16 +46,7 @@
+ int
+ __pthread_spin_trylock (pthread_spinlock_t *lock)
+ {
+- int oldval;
+-
+- asm volatile
+- ("mov ar.ccv = r0\n\t"
+- "mov r2 = 1\n\t"
+- ";;\n\t"
+- "cmpxchg4.acq %0 = %1, r2, ar.ccv\n\t"
+- ";;\n"
+- : "=r" (oldval) : "m" (lock) : "r2", "memory");
+- return oldval > 0 ? 0 : EBUSY;
++ return __sync_val_compare_and_swap_si ((int *) lock, 0, 1) == 0 ? 0 : EBUSY;
+ }
+ weak_alias (__pthread_spin_trylock, pthread_spin_trylock)
+
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/ia64/tcb-offsets.sym glibc-2.3.2/linuxthreads/sysdeps/ia64/tcb-offsets.sym
+--- glibc-2.3.2/linuxthreads.old/sysdeps/ia64/tcb-offsets.sym 2003-01-16 13:20:08.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/ia64/tcb-offsets.sym 2003-03-02 06:44:20.000000000 -0500
+@@ -3,7 +3,7 @@
+
+ --
+ #ifdef USE_TLS
+-MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_header.data.multiple_threads) - sizeof (struct _pthread_descr_struct)
++MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads) - sizeof (struct _pthread_descr_struct)
+ #else
+ MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
+ #endif
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/ia64/tls.h glibc-2.3.2/linuxthreads/sysdeps/ia64/tls.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/ia64/tls.h 2003-01-16 13:20:08.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/ia64/tls.h 2003-03-02 06:44:20.000000000 -0500
+@@ -98,6 +98,8 @@
+ # define INIT_THREAD_SELF(descr, nr) \
+ (__thread_self = (struct _pthread_descr_struct *)(descr) + 1)
+
++# define TLS_MULTIPLE_THREADS_IN_TCB 1
++
+ /* Get the thread descriptor definition. */
+ # include <linuxthreads/descr.h>
+
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/mips/pspinlock.c glibc-2.3.2/linuxthreads/sysdeps/mips/pspinlock.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/mips/pspinlock.c 2002-08-27 00:52:36.000000000 -0400
++++ glibc-2.3.2/linuxthreads/sysdeps/mips/pspinlock.c 2003-03-13 23:22:05.000000000 -0500
+@@ -1,5 +1,5 @@
+ /* POSIX spinlock implementation. MIPS version.
+- Copyright (C) 2000, 2002 Free Software Foundation, Inc.
++ Copyright (C) 2000, 2002, 2003 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
+@@ -32,7 +32,9 @@
+ ("\t\t\t# spin_lock\n"
+ "1:\n\t"
+ ".set push\n\t"
++#if _MIPS_SIM == _MIPS_SIM_ABI32
+ ".set mips2\n\t"
++#endif
+ "ll %1,%3\n\t"
+ "li %2,1\n\t"
+ "bnez %1,1b\n\t"
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/mips/pt-machine.h glibc-2.3.2/linuxthreads/sysdeps/mips/pt-machine.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/mips/pt-machine.h 2002-08-27 00:52:36.000000000 -0400
++++ glibc-2.3.2/linuxthreads/sysdeps/mips/pt-machine.h 2003-03-13 23:22:05.000000000 -0500
+@@ -1,6 +1,7 @@
+ /* Machine-dependent pthreads configuration and inline functions.
+
+- Copyright (C) 1996, 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1997, 1998, 2000, 2002, 2003
++ Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ralf Baechle <ralf@gnu.org>.
+ Based on the Alpha version by Richard Henderson <rth@tamu.edu>.
+@@ -60,12 +61,22 @@
+ ("/* Inline compare & swap */\n"
+ "1:\n\t"
+ ".set push\n\t"
++#if _MIPS_SIM == _MIPS_SIM_ABI32
+ ".set mips2\n\t"
++#endif
++#if defined _ABI64 && _MIPS_SIM == _ABI64
++ "lld %1,%5\n\t"
++#else
+ "ll %1,%5\n\t"
++#endif
+ "move %0,$0\n\t"
+ "bne %1,%3,2f\n\t"
+ "move %0,%4\n\t"
++#if defined _ABI64 && _MIPS_SIM == _ABI64
++ "scd %0,%2\n\t"
++#else
+ "sc %0,%2\n\t"
++#endif
+ ".set pop\n\t"
+ "beqz %0,1b\n"
+ "2:\n\t"
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/powerpc/powerpc64/pt-machine.h glibc-2.3.2/linuxthreads/sysdeps/powerpc/powerpc64/pt-machine.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/powerpc/powerpc64/pt-machine.h 2002-09-14 04:55:04.000000000 -0400
++++ glibc-2.3.2/linuxthreads/sysdeps/powerpc/powerpc64/pt-machine.h 2003-03-02 06:44:12.000000000 -0500
+@@ -1,6 +1,6 @@
+ /* Machine-dependent pthreads configuration and inline functions.
+ powerpc version.
+- Copyright (C) 2002 Free Software Foundation, Inc.
++ Copyright (C) 2002, 2003 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
+@@ -57,6 +57,16 @@
+ /* Initialize the thread-unique value. */
+ #define INIT_THREAD_SELF(descr, nr) (__thread_self = (descr))
+
++/* Access to data in the thread descriptor is easy. */
++#define THREAD_GETMEM(descr, member) \
++ ((void) (descr), THREAD_SELF->member)
++#define THREAD_GETMEM_NC(descr, member) \
++ ((void) (descr), THREAD_SELF->member)
++#define THREAD_SETMEM(descr, member, value) \
++ ((void) (descr), THREAD_SELF->member = (value))
++#define THREAD_SETMEM_NC(descr, member, value) \
++ ((void) (descr), THREAD_SELF->member = (value))
++
+ /* Compare-and-swap for semaphores. */
+ /* note that test-and-set(x) is the same as !compare-and-swap(x, 0, 1) */
+
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/powerpc/tcb-offsets.sym glibc-2.3.2/linuxthreads/sysdeps/powerpc/tcb-offsets.sym
+--- glibc-2.3.2/linuxthreads.old/sysdeps/powerpc/tcb-offsets.sym 2003-02-17 15:32:09.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/powerpc/tcb-offsets.sym 2003-03-02 06:44:10.000000000 -0500
+@@ -1,4 +1,24 @@
+ #include <sysdep.h>
+ #include <tls.h>
+
+-MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
++--
++
++-- This could go into powerpc32/ instead and conditionalize #include of it.
++#ifndef __powerpc64__
++
++# ifdef USE_TLS
++
++-- Abuse tls.h macros to derive offsets relative to the thread register.
++# undef __thread_register
++# define __thread_register ((void *) 0)
++# define thread_offsetof(mem) ((void *) &THREAD_SELF->p_##mem - (void *) 0)
++
++# else
++
++# define thread_offsetof(mem) offsetof (tcbhead_t, mem)
++
++# endif
++
++MULTIPLE_THREADS_OFFSET thread_offsetof (multiple_threads)
++
++#endif
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/powerpc/tls.h glibc-2.3.2/linuxthreads/sysdeps/powerpc/tls.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/powerpc/tls.h 2003-02-27 17:40:10.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/powerpc/tls.h 2003-03-02 06:44:14.000000000 -0500
+@@ -32,15 +32,6 @@
+ void *pointer;
+ } dtv_t;
+
+-typedef struct
+-{
+- void *tcb; /* Pointer to the TCB. Not necessary the
+- thread descriptor used by libpthread. */
+- dtv_t *dtv;
+- void *self; /* Pointer to the thread descriptor. */
+- int multiple_threads;
+-} tcbhead_t;
+-
+ #else /* __ASSEMBLER__ */
+ # include <tcb-offsets.h>
+ #endif /* __ASSEMBLER__ */
+@@ -52,6 +43,14 @@
+
+ # ifndef __ASSEMBLER__
+
++/* This layout is actually wholly private and not affected by the ABI.
++ Nor does it overlap the pthread data structure, so we need nothing
++ extra here at all. */
++typedef struct
++{
++ dtv_t *dtv;
++} tcbhead_t;
++
+ /* This is the size of the initial TCB. */
+ # define TLS_INIT_TCB_SIZE sizeof (tcbhead_t)
+
+@@ -67,12 +66,12 @@
+ /* This is the size we need before TCB. */
+ # define TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
+
+-/* The following assumes that TP (R13) is points to the end of the
++/* The following assumes that TP (R2 or R13) is points to the end of the
+ TCB + 0x7000 (per the ABI). This implies that TCB address is
+- R13-(TLS_TCB_SIZE + 0x7000). As we define TLS_DTV_AT_TP we can
++ TP-(TLS_TCB_SIZE + 0x7000). As we define TLS_DTV_AT_TP we can
+ assume that the pthread_descr is allocated immediately ahead of the
+ TCB. This implies that the pthread_descr address is
+- R13-(TLS_PRE_TCB_SIZE + TLS_TCB_SIZE + 0x7000). */
++ TP-(TLS_PRE_TCB_SIZE + TLS_TCB_SIZE + 0x7000). */
+ # define TLS_TCB_OFFSET 0x7000
+
+ /* The DTV is allocated at the TP; the TCB is placed elsewhere. */
+@@ -99,7 +98,7 @@
+ special attention since 'errno' is not yet available and if the
+ operation can cause a failure 'errno' must not be touched. */
+ # define TLS_INIT_TP(TCBP, SECONDCALL) \
+- (__thread_register = (void *) (TCBP) + TLS_TCB_OFFSET + TLS_TCB_SIZE, 0)
++ (__thread_register = (void *) (TCBP) + TLS_TCB_OFFSET + TLS_TCB_SIZE, NULL)
+
+ /* Return the address of the dtv for the current thread. */
+ # define THREAD_DTV() \
+@@ -116,30 +115,36 @@
+ (__thread_register = ((void *) (DESCR) \
+ + TLS_TCB_OFFSET + TLS_TCB_SIZE + TLS_PRE_TCB_SIZE))
+
++/* Make sure we have the p_multiple_threads member in the thread structure.
++ See below. */
++# ifndef __powerpc64__
++# define TLS_MULTIPLE_THREADS_IN_TCB 1
++# endif
++
+ /* Get the thread descriptor definition. */
+ # include <linuxthreads/descr.h>
+
+-/* Generic bits of LinuxThreads may call these macros with
+- DESCR set to NULL. We are expected to be able to reference
+- the "current" value. */
+-
+-# define THREAD_GETMEM(descr, member) \
+- ((void) sizeof (descr), THREAD_SELF->member)
+-# define THREAD_SETMEM(descr, member, value) \
+- ((void) sizeof (descr), THREAD_SELF->member = (value))
+-
+-#define THREAD_GETMEM_NC(descr, member) THREAD_GETMEM (descr, member)
+-#define THREAD_SETMEM_NC(descr, member, value) \
+- THREAD_SETMEM ((descr), member, (value))
+-
+ # endif /* __ASSEMBLER__ */
+
+-#else /* Not HAVE_TLS_SUPPORT. */
++#elif !defined __ASSEMBLER__ && !defined __powerpc64__
++
++/* This overlaps the start of the pthread_descr. On PPC32, system
++ calls and such use this to find the multiple_threads flag and need
++ to use the same offset relative to the thread register in both
++ single-threaded and multi-threaded code. On PPC64, the global
++ variable is always used, so single-threaded code without TLS
++ never needs to initialize the thread register at all. */
++typedef struct
++{
++ void *tcb; /* Never used. */
++ dtv_t *dtv; /* Never used. */
++ void *self; /* Used only if multithreaded, and rarely. */
++ int multiple_threads; /* Only this member is really used. */
++} tcbhead_t;
+
+ #define NONTLS_INIT_TP \
+ do { \
+- static const tcbhead_t nontls_init_tp \
+- = { .multiple_threads = 0 }; \
++ static const tcbhead_t nontls_init_tp = { .multiple_threads = 0 }; \
+ __thread_self = (__typeof (__thread_self)) &nontls_init_tp; \
+ } while (0)
+
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/bits/#libc-tsd.h# glibc-2.3.2/linuxthreads/sysdeps/pthread/bits/#libc-tsd.h#
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/bits/#libc-tsd.h# 2003-01-03 17:10:19.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/bits/#libc-tsd.h# 1969-12-31 19:00:00.000000000 -0500
+@@ -1,59 +0,0 @@
+-/* libc-internal interface for thread-specific data. LinuxThreads version.
+- Copyright (C) 1997,98,99,2001,02 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; see the file COPYING.LIB. If not,
+- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+- Boston, MA 02111-1307, USA. */
+-
+-#ifndef _BITS_LIBC_TSD_H
+-#define _BITS_LIBC_TSD_H 1
+-
+-#include <linuxthreads/descr.h>
+-#include <tls.h>
+-
+-#if USE_TLS && HAVE___THREAD
+-
+-/* When __thread works, the generic definition is what we want. */
+-# include <sysdeps/generic/bits/libc-tsd.h>
+-
+-#else
+-
+-# include <bits/libc-lock.h>
+-
+-# ifndef SHARED
+-extern void ** __pthread_internal_tsd_address (int);
+-extern void *__pthread_internal_tsd_get (int);
+-extern int __pthread_internal_tsd_set (int, const void *);
+-
+-weak_extern (__pthread_internal_tsd_address)
+-weak_extern (__pthread_internal_tsd_get)
+-weak_extern (__pthread_internal_tsd_set)
+-# endif
+-
+-#define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data;
+-#define __libc_tsd_address(KEY) \
+- __libc_maybe_call2 (pthread_internal_tsd_address, \
+- (_LIBC_TSD_KEY_##KEY), &__libc_tsd_##KEY##_data)
+-#define __libc_tsd_get(KEY) \
+- __libc_maybe_call2 (pthread_internal_tsd_get, \
+- (_LIBC_TSD_KEY_##KEY), __libc_tsd_##KEY##_data)
+-#define __libc_tsd_set(KEY, VALUE) \
+- __libc_maybe_call2 (pthread_internal_tsd_set, \
+- (_LIBC_TSD_KEY_##KEY, (VALUE)), \
+- (__libc_tsd_##KEY##_data = (VALUE), 0))
+-
+-#endif
+-
+-#endif /* bits/libc-tsd.h */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/bits/typesizes.h glibc-2.3.2/linuxthreads/sysdeps/pthread/bits/typesizes.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/bits/typesizes.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/bits/typesizes.h 2003-03-25 15:39:24.000000000 -0500
+@@ -0,0 +1,65 @@
++/* bits/typesizes.h -- underlying types for *_t. Generic version.
++ Copyright (C) 2002, 2003 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. */
++
++#ifndef _BITS_TYPES_H
++# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
++#endif
++
++#ifndef _BITS_TYPESIZES_H
++#define _BITS_TYPESIZES_H 1
++
++/* See <bits/types.h> for the meaning of these macros. This file exists so
++ that <bits/types.h> need not vary across different GNU platforms. */
++
++#define __DEV_T_TYPE __UQUAD_TYPE
++#define __UID_T_TYPE __U32_TYPE
++#define __GID_T_TYPE __U32_TYPE
++#define __INO_T_TYPE __ULONGWORD_TYPE
++#define __INO64_T_TYPE __UQUAD_TYPE
++#define __MODE_T_TYPE __U32_TYPE
++#define __NLINK_T_TYPE __UWORD_TYPE
++#define __OFF_T_TYPE __SLONGWORD_TYPE
++#define __OFF64_T_TYPE __SQUAD_TYPE
++#define __PID_T_TYPE __S32_TYPE
++#define __RLIM_T_TYPE __ULONGWORD_TYPE
++#define __RLIM64_T_TYPE __UQUAD_TYPE
++#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
++#define __BLKCNT64_T_TYPE __SQUAD_TYPE
++#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
++#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
++#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
++#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
++#define __ID_T_TYPE __U32_TYPE
++#define __CLOCK_T_TYPE __SLONGWORD_TYPE
++#define __TIME_T_TYPE __SLONGWORD_TYPE
++#define __USECONDS_T_TYPE __U32_TYPE
++#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
++#define __DADDR_T_TYPE __S32_TYPE
++#define __SWBLK_T_TYPE __SLONGWORD_TYPE
++#define __KEY_T_TYPE __S32_TYPE
++#define __CLOCKID_T_TYPE __S32_TYPE
++#define __TIMER_T_TYPE __S32_TYPE
++#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
++#define __FSID_T_TYPE struct { int __val[2]; }
++
++/* Number of descriptors that can fit in an `fd_set'. */
++#define __FD_SETSIZE 1024
++
++
++#endif /* bits/typesizes.h */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/errno-loc.c glibc-2.3.2/linuxthreads/sysdeps/pthread/errno-loc.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/errno-loc.c 2002-12-31 14:14:22.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/errno-loc.c 2003-03-31 19:52:40.000000000 -0500
+@@ -1,6 +1,6 @@
+ /* MT support function to get address of `errno' variable, linuxthreads
+ version.
+- Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc.
++ Copyright (C) 1996, 1998, 2002, 2003 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
+@@ -20,6 +20,7 @@
+
+ #include <errno.h>
+ #include <tls.h>
++#include <linuxthreads/internals.h>
+ #include <sysdep-cancel.h>
+
+ #if ! USE___THREAD
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/herrno-loc.c glibc-2.3.2/linuxthreads/sysdeps/pthread/herrno-loc.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/herrno-loc.c 2002-12-31 14:14:22.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/herrno-loc.c 2003-03-31 19:52:40.000000000 -0500
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
++/* Copyright (C) 1996, 97, 98, 2002, 2003 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
+@@ -18,6 +18,7 @@
+
+ #include <netdb.h>
+ #include <tls.h>
++#include <linuxthreads/internals.h>
+ #include <sysdep-cancel.h>
+
+ #if ! USE___THREAD
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/Makefile glibc-2.3.2/linuxthreads/sysdeps/pthread/Makefile
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/Makefile 2003-02-12 16:40:09.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/Makefile 2003-03-19 12:57:45.000000000 -0500
+@@ -9,5 +9,5 @@
+ endif
+
+ ifeq ($(subdir),posix)
+-CFLAGS-confstr.c += -DLIBPTHREAD_VERSION="\"$(shell sed 's/\(.*\) by .*/\1/' ../nptl/Banner)\""
++CFLAGS-confstr.c += -DLIBPTHREAD_VERSION="\"$(shell sed 's/\(.*\) by .*/\1/' ../linuxthreads/Banner)\""
+ endif
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/res-state.c glibc-2.3.2/linuxthreads/sysdeps/pthread/res-state.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/res-state.c 2002-12-31 14:14:22.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/res-state.c 2003-03-31 19:52:40.000000000 -0500
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 1996, 97, 98, 2002 Free Software Foundation, Inc.
++/* Copyright (C) 1996, 97, 98, 2002, 2003 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
+@@ -18,6 +18,7 @@
+
+ #include <resolv.h>
+ #include <tls.h>
++#include <linuxthreads/internals.h>
+ #include <sysdep-cancel.h>
+
+ #if ! USE___THREAD
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/pthread/timer_create.c glibc-2.3.2/linuxthreads/sysdeps/pthread/timer_create.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/pthread/timer_create.c 2002-08-27 00:52:36.000000000 -0400
++++ glibc-2.3.2/linuxthreads/sysdeps/pthread/timer_create.c 2003-03-03 00:28:17.000000000 -0500
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2000 Free Software Foundation, Inc.
++/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Kaz Kylheku <kaz@ashi.footprints.net>.
+
+@@ -37,15 +37,23 @@
+ struct timer_node *newtimer = NULL;
+ struct thread_node *thread = NULL;
+
+- if (clock_id != CLOCK_REALTIME
++ if (0
+ #ifdef _POSIX_CPUTIME
+- && clock_id != CLOCK_PROCESS_CPUTIME_ID
++ || clock_id == CLOCK_PROCESS_CPUTIME_ID
+ #endif
+ #ifdef _POSIX_THREAD_CPUTIME
+- && clock_id != CLOCK_THREAD_CPUTIME_ID
++ || clock_id == CLOCK_THREAD_CPUTIME_ID
+ #endif
+ )
+ {
++ /* We don't allow timers for CPU clocks. At least not in the
++ moment. */
++ __set_errno (ENOTSUP);
++ return -1;
++ }
++
++ if (clock_id != CLOCK_REALTIME)
++ {
+ __set_errno (EINVAL);
+ return -1;
+ }
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/sh/tcb-offsets.sym glibc-2.3.2/linuxthreads/sysdeps/sh/tcb-offsets.sym
+--- glibc-2.3.2/linuxthreads.old/sysdeps/sh/tcb-offsets.sym 2003-02-07 21:29:53.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/sh/tcb-offsets.sym 2003-03-02 06:44:20.000000000 -0500
+@@ -3,7 +3,7 @@
+
+ --
+ #ifdef USE_TLS
+-MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_header.data.multiple_threads)
++MULTIPLE_THREADS_OFFSET offsetof (struct _pthread_descr_struct, p_multiple_threads)
+ TLS_PRE_TCB_SIZE sizeof (struct _pthread_descr_struct)
+ #else
+ MULTIPLE_THREADS_OFFSET offsetof (tcbhead_t, multiple_threads)
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/sh/tls.h glibc-2.3.2/linuxthreads/sysdeps/sh/tls.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/sh/tls.h 2003-02-07 21:29:53.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/sh/tls.h 2003-03-02 06:44:20.000000000 -0500
+@@ -112,6 +112,8 @@
+ __asm __volatile ("ldc %0,gbr" : : "r" (__self + 1)); \
+ 0; })
+
++# define TLS_MULTIPLE_THREADS_IN_TCB 1
++
+ /* Get the thread descriptor definition. This must be after the
+ the definition of THREAD_SELF for TLS. */
+ # include <linuxthreads/descr.h>
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/alpha/bits/typesizes.h 2003-03-25 17:03:21.000000000 -0500
+@@ -0,0 +1,65 @@
++/* bits/typesizes.h -- underlying types for *_t. Linux/Alpha version.
++ Copyright (C) 2002 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. */
++
++#ifndef _BITS_TYPES_H
++# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
++#endif
++
++#ifndef _BITS_TYPESIZES_H
++#define _BITS_TYPESIZES_H 1
++
++/* See <bits/types.h> for the meaning of these macros. This file exists so
++ that <bits/types.h> need not vary across different GNU platforms. */
++
++#define __DEV_T_TYPE __U64_TYPE
++#define __UID_T_TYPE __U32_TYPE
++#define __GID_T_TYPE __U32_TYPE
++#define __INO_T_TYPE __U32_TYPE
++#define __INO64_T_TYPE __U64_TYPE
++#define __MODE_T_TYPE __U32_TYPE
++#define __NLINK_T_TYPE __U32_TYPE
++#define __OFF_T_TYPE __SLONGWORD_TYPE
++#define __OFF64_T_TYPE __S64_TYPE
++#define __PID_T_TYPE __S32_TYPE
++#define __RLIM_T_TYPE __ULONGWORD_TYPE
++#define __RLIM64_T_TYPE __U64_TYPE
++#define __BLKCNT_T_TYPE __U32_TYPE
++#define __BLKCNT64_T_TYPE __U64_TYPE
++#define __FSBLKCNT_T_TYPE __S32_TYPE
++#define __FSBLKCNT64_T_TYPE __S64_TYPE
++#define __FSFILCNT_T_TYPE __U32_TYPE
++#define __FSFILCNT64_T_TYPE __U64_TYPE
++#define __ID_T_TYPE __U32_TYPE
++#define __CLOCK_T_TYPE __SLONGWORD_TYPE
++#define __TIME_T_TYPE __SLONGWORD_TYPE
++#define __USECONDS_T_TYPE __U32_TYPE
++#define __SUSECONDS_T_TYPE __S64_TYPE
++#define __DADDR_T_TYPE __S32_TYPE
++#define __SWBLK_T_TYPE __SLONGWORD_TYPE
++#define __KEY_T_TYPE __S32_TYPE
++#define __CLOCKID_T_TYPE __S32_TYPE
++#define __TIMER_T_TYPE __S32_TYPE
++#define __BLKSIZE_T_TYPE __U32_TYPE
++#define __FSID_T_TYPE struct { int __val[2]; }
++
++/* Number of descriptors that can fit in an `fd_set'. */
++#define __FD_SETSIZE 1024
++
++
++#endif /* bits/typesizes.h */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/alpha/pt-sigsuspend.S glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/alpha/pt-sigsuspend.S
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/alpha/pt-sigsuspend.S 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/alpha/pt-sigsuspend.S 2003-04-01 19:10:44.000000000 -0500
+@@ -0,0 +1,28 @@
++/* Internal sigsuspend system call for LinuxThreads. Alpha version.
++ Copyright (C) 2003 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 <sysdep.h>
++
++#undef PSEUDO_PREPARE_ARGS
++#define PSEUDO_PREPARE_ARGS ldq a0, 0(a0);
++
++ .hidden __pthread_sigsuspend
++PSEUDO_NOERRNO(__pthread_sigsuspend, sigsuspend, 1)
++ ret
++PSEUDO_END_NOERRNO(__pthread_sigsuspend)
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h 2003-01-12 04:13:57.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/arm/sysdep-cancel.h 2003-03-25 04:44:29.000000000 -0500
+@@ -24,6 +24,15 @@
+
+ #if !defined NOT_IN_libc || defined IS_IN_libpthread
+
++/* We push lr onto the stack, so we have to use ldmib instead of ldmia
++ to find the saved arguments. */
++#undef DOARGS_5
++#undef DOARGS_6
++#undef DOARGS_7
++#define DOARGS_5 str r4, [sp, $-4]!; ldr r4, [sp, $8];
++#define DOARGS_6 mov ip, sp; stmfd sp!, {r4, r5}; ldmib ip, {r4, r5};
++#define DOARGS_7 mov ip, sp; stmfd sp!, {r4, r5, r6}; ldmib ip, {r4, r5, r6};
++
+ # undef PSEUDO_RET
+ # define PSEUDO_RET \
+ ldrcc pc, [sp], $4; \
+@@ -110,7 +119,7 @@
+ ldr reg, 2b; \
+ 3: \
+ add ip, pc, ip; \
+- ldr ip, [ip, lr]; \
++ ldr ip, [ip, reg]; \
+ teq ip, #0;
+ # define SINGLE_THREAD_P_INT \
+ str lr, [sp, $-4]!; \
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/bits/posix_opt.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/bits/posix_opt.h 2002-11-28 20:48:24.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h 2003-03-02 23:55:24.000000000 -0500
+@@ -1,5 +1,5 @@
+ /* Define POSIX options for Linux.
+- Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
++ Copyright (C) 1996-2001, 2002, 2003 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
+@@ -132,4 +132,7 @@
+ /* POSIX message queues are not yet supported. */
+ #undef _POSIX_MESSAGE_PASSING
+
++/* The monotonic clock might be available. */
++#define _POSIX_MONOTONIC_CLOCK 0
++
+ #endif /* posix_opt.h */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/fork.c glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/fork.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/fork.c 2003-01-02 18:26:04.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/fork.c 2003-03-21 19:06:53.000000000 -0500
+@@ -39,4 +39,5 @@
+ return __libc_maybe_call2 (pthread_fork, (&__fork_block), ARCH_FORK ());
+ }
+ weak_alias (__libc_fork, __fork)
++libc_hidden_def (__fork)
+ weak_alias (__libc_fork, fork)
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h 2002-11-28 20:47:54.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h 2003-03-02 23:55:24.000000000 -0500
+@@ -1,5 +1,5 @@
+ /* Define POSIX options for Linux/ix86.
+- Copyright (C) 1996-2001, 2002 Free Software Foundation, Inc.
++ Copyright (C) 1996-2001, 2002, 2003 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
+@@ -138,4 +138,7 @@
+ /* POSIX message queues are not yet supported. */
+ #undef _POSIX_MESSAGE_PASSING
+
++/* The monotonic clock might be available. */
++#define _POSIX_MONOTONIC_CLOCK 0
++
+ #endif /* posix_opt.h */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/ia64/pt-sigsuspend.c glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/ia64/pt-sigsuspend.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/ia64/pt-sigsuspend.c 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/ia64/pt-sigsuspend.c 2003-04-01 19:10:45.000000000 -0500
+@@ -0,0 +1,33 @@
++/* Internal sigsuspend system call for LinuxThreads. IA64 version.
++ Copyright (C) 2003 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 <errno.h>
++#include <signal.h>
++#include <unistd.h>
++
++#include <sysdep.h>
++#include <sys/syscall.h>
++#include <linuxthreads/internals.h>
++
++void
++__pthread_sigsuspend (const sigset_t *set)
++{
++ INTERNAL_SYSCALL_DECL (err);
++ INTERNAL_SYSCALL (rt_sigsuspend, err, 2, set, _NSIG / 8);
++}
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h 2003-01-09 14:43:34.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/ia64/sysdep-cancel.h 2003-03-02 06:44:20.000000000 -0500
+@@ -101,8 +101,7 @@
+
+ # ifndef __ASSEMBLER__
+ # define SINGLE_THREAD_P \
+- __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+- p_header.data.multiple_threads) == 0, 1)
++ __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
+ # else
+ # define SINGLE_THREAD_P \
+ adds r14 = MULTIPLE_THREADS_OFFSET, r13 ;; ld4 r14 = [r14] ;; cmp4.ne p6, p7 = 0, r14
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h 2003-02-17 15:32:09.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep-cancel.h 2003-03-02 06:44:20.000000000 -0500
+@@ -85,8 +85,7 @@
+
+ # ifndef __ASSEMBLER__
+ # define SINGLE_THREAD_P \
+- __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+- p_header.data.multiple_threads) == 0, 1)
++ __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
+ # else
+ # define SINGLE_THREAD_P \
+ lwz 10,MULTIPLE_THREADS_OFFSET(2); \
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/pt-sigsuspend.c glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/pt-sigsuspend.c 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c 2003-04-01 19:10:44.000000000 -0500
+@@ -0,0 +1,56 @@
++/* Internal sigsuspend system call for LinuxThreads. Generic Linux version.
++ Copyright (C) 2003 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 <errno.h>
++#include <signal.h>
++#include <unistd.h>
++
++#include <sysdep.h>
++#include <sys/syscall.h>
++#include <linuxthreads/internals.h>
++
++#include "kernel-features.h"
++
++void
++__pthread_sigsuspend (const sigset_t *set)
++{
++ INTERNAL_SYSCALL_DECL (err);
++#if !__ASSUME_REALTIME_SIGNALS
++ static int __pthread_missing_rt_sigs;
++
++# ifdef __NR_rt_sigsuspend
++ /* First try the RT signals. */
++ if (!__pthread_missing_rt_sigs)
++ {
++ /* XXX The size argument hopefully will have to be changed to the
++ real size of the user-level sigset_t. */
++ int r;
++ r = INTERNAL_SYSCALL (rt_sigsuspend, err, 2, set, _NSIG / 8);
++ if (INTERNAL_SYSCALL_ERRNO (r, err) != ENOSYS)
++ return;
++
++ __pthread_missing_rt_sigs = 1;
++ }
++# endif
++
++ INTERNAL_SYSCALL (sigsuspend, err, 3, 0, 0, set->__val[0]);
++#else
++ INTERNAL_SYSCALL (rt_sigsuspend, err, 2, set, _NSIG / 8);
++#endif
++}
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/s390/s390-64/pt-sigsuspend.c 2003-04-01 19:10:45.000000000 -0500
+@@ -0,0 +1 @@
++#include "../../ia64/pt-sigsuspend.c"
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h 2003-02-07 21:29:53.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sh/sysdep-cancel.h 2003-03-02 06:44:19.000000000 -0500
+@@ -121,8 +121,7 @@
+ # ifndef __ASSEMBLER__
+ # if defined FLOATING_STACKS && USE___THREAD && defined PIC
+ # define SINGLE_THREAD_P \
+- __builtin_expect (THREAD_GETMEM (THREAD_SELF, \
+- p_header.data.multiple_threads) == 0, 1)
++ __builtin_expect (THREAD_GETMEM (THREAD_SELF, p_multiple_threads) == 0, 1)
+ # else
+ extern int __local_multiple_threads attribute_hidden;
+ # define SINGLE_THREAD_P __builtin_expect (__local_multiple_threads == 0, 1)
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/bits/typesizes.h 2003-03-25 17:02:20.000000000 -0500
+@@ -0,0 +1,65 @@
++/* bits/typesizes.h -- underlying types for *_t. Linux/SPARC version.
++ Copyright (C) 2002 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. */
++
++#ifndef _BITS_TYPES_H
++# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
++#endif
++
++#ifndef _BITS_TYPESIZES_H
++#define _BITS_TYPESIZES_H 1
++
++/* See <bits/types.h> for the meaning of these macros. This file exists so
++ that <bits/types.h> need not vary across different GNU platforms. */
++
++#define __DEV_T_TYPE __UQUAD_TYPE
++#define __UID_T_TYPE __U32_TYPE
++#define __GID_T_TYPE __U32_TYPE
++#define __INO_T_TYPE __ULONGWORD_TYPE
++#define __INO64_T_TYPE __UQUAD_TYPE
++#define __MODE_T_TYPE __U32_TYPE
++#define __NLINK_T_TYPE __U32_TYPE
++#define __OFF_T_TYPE __SLONGWORD_TYPE
++#define __OFF64_T_TYPE __SQUAD_TYPE
++#define __PID_T_TYPE __S32_TYPE
++#define __RLIM_T_TYPE __ULONGWORD_TYPE
++#define __RLIM64_T_TYPE __UQUAD_TYPE
++#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
++#define __BLKCNT64_T_TYPE __SQUAD_TYPE
++#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
++#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
++#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
++#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
++#define __ID_T_TYPE __U32_TYPE
++#define __CLOCK_T_TYPE __SLONGWORD_TYPE
++#define __TIME_T_TYPE __SLONGWORD_TYPE
++#define __USECONDS_T_TYPE __U32_TYPE
++#define __SUSECONDS_T_TYPE __S32_TYPE
++#define __DADDR_T_TYPE __S32_TYPE
++#define __SWBLK_T_TYPE __SLONGWORD_TYPE
++#define __KEY_T_TYPE __S32_TYPE
++#define __CLOCKID_T_TYPE __S32_TYPE
++#define __TIMER_T_TYPE __S32_TYPE
++#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
++#define __FSID_T_TYPE struct { int __val[2]; }
++
++/* Number of descriptors that can fit in an `fd_set'. */
++#define __FD_SETSIZE 1024
++
++
++#endif /* bits/typesizes.h */
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/Makefile glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/Makefile
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/Makefile 2003-02-21 13:55:30.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/Makefile 2003-03-14 18:36:52.000000000 -0500
+@@ -6,6 +6,6 @@
+ generated += specs
+ $(objpfx)specs:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -dumpspecs \
+- | sed 's,\(/usr/lib\(\|64\)/\|^\|\([^/a-z]\)\)\(crt[in]\.o\),\3./\4,g' > $@.new
++ | sed 's~\(/usr/lib\(\|64\)/\|^\|\([^/a-z]\)\)\(crt[in]\.o\)~\3'$(objpfx)'\4~g' > $@.new
+ mv -f $@.new $@
+ endif
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/Makefile 2003-03-14 18:36:52.000000000 -0500
+@@ -0,0 +1,5 @@
++# glibc makefile fragment for linuxthreads on sparc/sparc64.
++
++ifeq ($(subdir),linuxthreads)
++libpthread-routines += ptw-sigprocmask
++endif
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/sparc/sparc64/pt-sigsuspend.c 2003-04-01 19:10:44.000000000 -0500
+@@ -0,0 +1 @@
++#include "../../ia64/pt-sigsuspend.c"
+diff -Nur glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/x86_64/pt-sigsuspend.c glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/x86_64/pt-sigsuspend.c
+--- glibc-2.3.2/linuxthreads.old/sysdeps/unix/sysv/linux/x86_64/pt-sigsuspend.c 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/sysdeps/unix/sysv/linux/x86_64/pt-sigsuspend.c 2003-04-01 19:10:45.000000000 -0500
+@@ -0,0 +1 @@
++#include "../ia64/pt-sigsuspend.c"
+diff -Nur glibc-2.3.2/linuxthreads.old/tst-cancel4.c glibc-2.3.2/linuxthreads/tst-cancel4.c
+--- glibc-2.3.2/linuxthreads.old/tst-cancel4.c 2002-12-28 02:49:20.000000000 -0500
++++ glibc-2.3.2/linuxthreads/tst-cancel4.c 2003-03-06 16:39:15.000000000 -0500
+@@ -1,4 +1,4 @@
+-/* Copyright (C) 2002 Free Software Foundation, Inc.
++/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+@@ -154,7 +154,7 @@
+ exit (1);
+ }
+
+- sleep (10000000);
++ sleep (1000000);
+
+ printf ("%s: sleep returns\n", __FUNCTION__);
+
+diff -Nur glibc-2.3.2/linuxthreads.old/tst-cancel7.c glibc-2.3.2/linuxthreads/tst-cancel7.c
+--- glibc-2.3.2/linuxthreads.old/tst-cancel7.c 1969-12-31 19:00:00.000000000 -0500
++++ glibc-2.3.2/linuxthreads/tst-cancel7.c 2003-04-01 19:10:44.000000000 -0500
+@@ -0,0 +1,111 @@
++/* Test for pthread cancellation of mutex blocks.
++ Copyright (C) 2003 Free Software Foundation, Inc.
++ This file is part of the GNU C Library.
++ Contributed by Jakub Jelinek <jakub@redhat.com>, 2003.
++
++ 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 <pthread.h>
++#include <stdio.h>
++#include <stdlib.h>
++#include <unistd.h>
++
++pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
++pthread_barrier_t b;
++int value = 0;
++
++static void *
++tf (void *arg)
++{
++ int r = pthread_barrier_wait (&b);
++ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
++ {
++ printf ("%s: barrier_wait failed\n", __FUNCTION__);
++ exit (1);
++ }
++
++ pthread_mutex_lock (&lock);
++ ++value;
++ pthread_testcancel ();
++ ++value;
++ pthread_mutex_unlock (&lock);
++ return NULL;
++}
++
++
++static int
++do_test (void)
++{
++ pthread_mutex_lock (&lock);
++
++ if (pthread_barrier_init (&b, NULL, 2) != 0)
++ {
++ puts ("barrier init failed");
++ return 1;
++ }
++
++ pthread_t th;
++ if (pthread_create (&th, NULL, tf, NULL) != 0)
++ {
++ puts ("pthread_create failed");
++ return 1;
++ }
++
++ int r = pthread_barrier_wait (&b);
++ if (r != 0 && r != PTHREAD_BARRIER_SERIAL_THREAD)
++ {
++ printf ("%s: barrier_wait failed\n", __FUNCTION__);
++ exit (1);
++ }
++
++ if (pthread_cancel (th) != 0)
++ {
++ puts ("pthread_cancel failed");
++ return 1;
++ }
++
++ pthread_mutex_unlock (&lock);
++
++ void *status;
++ if (pthread_join (th, &status) != 0)
++ {
++ puts ("join failed");
++ return 1;
++ }
++
++ if (status != PTHREAD_CANCELED)
++ {
++ puts ("thread not canceled");
++ return 1;
++ }
++
++ if (value == 0)
++ {
++ puts ("thread cancelled in the pthread_mutex_lock call");
++ return 1;
++ }
++
++ if (value != 1)
++ {
++ puts ("thread not cancelled in pthread_testcancel call");
++ return 1;
++ }
++
++ return 0;
++}
++
++#define TEST_FUNCTION do_test ()
++#include "../test-skeleton.c"
+diff -Nur glibc-2.3.2/linuxthreads.old/Versions glibc-2.3.2/linuxthreads/Versions
+--- glibc-2.3.2/linuxthreads.old/Versions 2003-01-02 17:33:45.000000000 -0500
++++ glibc-2.3.2/linuxthreads/Versions 2003-03-18 22:34:41.000000000 -0500
+@@ -80,7 +80,7 @@
+ sigwait;
+
+ # Protected names for functions used in other shared objects.
+- __pthread_atfork; __pthread_initialize; __pthread_getspecific;
++ __pthread_atfork; __pthread_getspecific;
+ __pthread_key_create; __pthread_mutex_destroy; __pthread_mutex_init;
+ __pthread_mutex_lock; __pthread_mutex_trylock; __pthread_mutex_unlock;
+ __pthread_mutexattr_destroy; __pthread_mutexattr_init;
+@@ -147,7 +147,7 @@
+ pthread_getcpuclockid;
+ pthread_barrier_destroy; pthread_barrier_init; pthread_barrier_wait;
+ pthread_barrierattr_destroy; pthread_barrierattr_init;
+- pthread_barrierattr_getpshared; pthread_barrierattr_setpshared;
++ pthread_barrierattr_setpshared;
+ pthread_mutex_timedlock;
+ pthread_rwlock_timedrdlock; pthread_rwlock_timedwrlock;
+
+@@ -170,6 +170,7 @@
+ }
+ GLIBC_PRIVATE {
+ # Internal libc interface to libpthread
++ __pthread_initialize;
+ __pthread_kill_other_threads_np;
+ }
+ }