svn commit: branches/uClibc-nptl/libpthread: linuxthreads linuxthreads/sysdeps/avr32 etc...

carmelo at uclibc.org carmelo at uclibc.org
Mon Nov 17 09:45:29 UTC 2008


Author: carmelo
Date: 2008-11-17 01:45:29 -0800 (Mon, 17 Nov 2008)
New Revision: 24072

Log:
Synch with trunk @ 24071.
Step 1
linuxthreads - linuxthreads_db - linuxthread.old - linuxthreads.old_db


Modified:
   branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in
   branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/internals.h
   branches/uClibc-nptl/libpthread/linuxthreads.old/ptfork.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c
   branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h
   branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h
   branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch
   branches/uClibc-nptl/libpthread/linuxthreads.old/wrapsyscall.c
   branches/uClibc-nptl/libpthread/linuxthreads.old_db/Makefile.in
   branches/uClibc-nptl/libpthread/linuxthreads/Makefile.in
   branches/uClibc-nptl/libpthread/linuxthreads/pthread.c
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/i386/pt-machine.h
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/mips/pspinlock.c
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h
   branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S
   branches/uClibc-nptl/libpthread/linuxthreads_db/Makefile.in


Changeset:
Modified: branches/uClibc-nptl/libpthread/linuxthreads/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/Makefile.in	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/Makefile.in	2008-11-17 09:45:29 UTC (rev 24072)
@@ -1,7 +1,7 @@
 # Makefile for uClibc
 #
 # Copyright (C) 2003 Paul Mundt <lethal at linux-sh.org>
-# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
@@ -81,9 +81,6 @@
 
 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
-objclean-y += libpthread_clean
-headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
-headers_clean-y += linuxthreads_headers_clean
 
 #ifeq ($(DOMULTI),n)
 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a
@@ -124,13 +121,16 @@
 	$(do_ln) ../$(PTDIR)/$(@F) $(top_builddir)$@
 include/bits/pthreadtypes.h: | include/bits
 	$(do_ln) ../../$(PTDIR)/sysdeps/pthread/bits/$(@F) $(top_builddir)$@
-linuxthreads_headers: include/pthread.h include/semaphore.h \
+
+linuxthreads_headers := include/pthread.h include/semaphore.h \
 			include/bits/pthreadtypes.h
+$(linuxthreads_headers): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
 
+objclean-y += libpthread_clean
+headers_clean-y += linuxthreads_headers_clean
 linuxthreads_headers_clean:
-	$(RM) $(top_builddir)include/pthread.h \
-		$(top_builddir)include/semaphore.h \
-		$(top_builddir)include/bits/pthreadtypes.h
+	$(do_rm) $(addprefix $(top_builddir),$(linuxthreads_headers))
 
 libpthread_clean:
-	$(RM) $(libpthread_OUT)/{,*/,*/*/,*/*/*/,*/*/*/*/}*.{o,os,oS,a}
+	$(do_rm) $(addprefix $(libpthread_OUT)/,$(foreach e, o os oS a,$(foreach d, *. */*. */*/*. */*/*/*.,$(d)$(e))))

Modified: branches/uClibc-nptl/libpthread/linuxthreads/pthread.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/pthread.c	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/pthread.c	2008-11-17 09:45:29 UTC (rev 24072)
@@ -45,11 +45,12 @@
 extern int _errno;
 extern int _h_errno;
 
+# if defined __UCLIBC_HAS_IPv4__ || defined __UCLIBC_HAS_IPV6__
 /* We need the global/static resolver state here.  */
 # include <resolv.h>
 # undef _res
-
 extern struct __res_state _res;
+# endif
 #endif
 
 #ifdef USE_TLS
@@ -72,7 +73,9 @@
 #if !(USE_TLS && HAVE___THREAD)
   .p_errnop = &_errno,
   .p_h_errnop = &_h_errno,
+# if defined __UCLIBC_HAS_IPv4__ || defined __UCLIBC_HAS_IPV6__
   .p_resp = &_res,
+# endif
 #endif
   .p_userstack = 1,
   .p_resume_count = __ATOMIC_INITIALIZER,
@@ -539,15 +542,17 @@
 #ifdef USE_TLS
   /* Update the descriptor for the initial thread. */
   THREAD_SETMEM (((pthread_descr) NULL), p_pid, __getpid());
-# ifndef HAVE___THREAD
+# if !defined HAVE___THREAD && (defined __UCLIBC_HAS_IPv4__ || defined __UCLIBC_HAS_IPV6__)
   /* Likewise for the resolver state _res.  */
   THREAD_SETMEM (((pthread_descr) NULL), p_resp, &_res);
 # endif
 #else
   /* Update the descriptor for the initial thread. */
   __pthread_initial_thread.p_pid = __getpid();
+# if defined __UCLIBC_HAS_IPv4__ || defined __UCLIBC_HAS_IPV6__
   /* Likewise for the resolver state _res.  */
   __pthread_initial_thread.p_resp = &_res;
+# endif
 #endif
 #if !__ASSUME_REALTIME_SIGNALS
   /* Initialize real-time signals. */
@@ -562,12 +567,12 @@
   __libc_sigaction(__pthread_sig_restart, &sa, NULL);
   sa.sa_handler = pthread_handle_sigcancel;
   sigaddset(&sa.sa_mask, __pthread_sig_restart);
-  // sa.sa_flags = 0;
+  /* sa.sa_flags = 0; */
   __libc_sigaction(__pthread_sig_cancel, &sa, NULL);
   if (__pthread_sig_debug > 0) {
     sa.sa_handler = pthread_handle_sigdebug;
     sigemptyset(&sa.sa_mask);
-    // sa.sa_flags = 0;
+    /* sa.sa_flags = 0; */
     __libc_sigaction(__pthread_sig_debug, &sa, NULL);
   }
   /* Initially, block __pthread_sig_restart. Will be unblocked on demand. */
@@ -1112,7 +1117,9 @@
   /* Now this thread modifies the global variables.  */
   THREAD_SETMEM(self, p_errnop, &_errno);
   THREAD_SETMEM(self, p_h_errnop, &_h_errno);
+# if defined __UCLIBC_HAS_IPv4__ || defined __UCLIBC_HAS_IPV6__
   THREAD_SETMEM(self, p_resp, &_res);
+# endif
 #endif
 
 #ifndef FLOATING_STACKS

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -15,8 +15,8 @@
 # define PT_EI __extern_always_inline
 #endif
 
-static inline int
-_test_and_set (int *p, int v) __THROW
+static __inline__ int
+_test_and_set (int *p, int v)
 {
 	int result;
 
@@ -52,7 +52,7 @@
 PT_EI int
 __compare_and_swap(long int *p, long int oldval, long int newval)
 {
-	int result;
+	long int result;
 
 	__asm__ __volatile__(
 		"/* Inline compare and swap */\n"

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/i386/pt-machine.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/i386/pt-machine.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/i386/pt-machine.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -32,10 +32,9 @@
 # define PT_EI __extern_always_inline
 #endif
 
-/*
 extern long int testandset (int *spinlock);
 extern int __compare_and_swap (long int *p, long int oldval, long int newval);
-*/
+
 /* Get some notion of the current stack.  Need not be exactly the top
    of the stack, just something somewhere in the current frame.  */
 #define CURRENT_STACK_FRAME  __builtin_frame_address (0)

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/mips/pspinlock.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/mips/pspinlock.c	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/mips/pspinlock.c	2008-11-17 09:45:29 UTC (rev 24072)
@@ -23,8 +23,6 @@
 #include <sys/tas.h>
 #include "internals.h"
 
-#include <sgidefs.h>
-
 /* This implementation is similar to the one used in the Linux kernel.  */
 int
 __pthread_spin_lock (pthread_spinlock_t *lock)

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -62,6 +62,14 @@
 # define __ASSUME_VFORK_SYSCALL		1
 #endif
 
+/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
+ *    information as well and in between 2.6.5 and 2.6.8 most compat wrappers
+ *       were fixed too.  Except s390{,x} which was fixed in 2.6.11.  */
+#if (__LINUX_KERNEL_VERSION >= 0x020608 && !defined __s390__) \
+    || (__LINUX_KERNEL_VERSION >= 0x02060b && defined __s390__)
+# define __ASSUME_GETDENTS32_D_TYPE 1
+#endif
+
 /* These features were surely available with 2.4.12.  */
 #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
 # define __ASSUME_MMAP2_SYSCALL		1

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -42,8 +42,6 @@
 
 /* Use a funky version in a probably vein attempt at preventing gdb
  * from dlopen()'ing glibc's libthread_db library... */
-#define STRINGIFY(s) STRINGIFY2 (s)
-#define STRINGIFY2(s) #s
-#define VERSION STRINGIFY(__UCLIBC_MAJOR__) "." STRINGIFY(__UCLIBC_MINOR__) "." STRINGIFY(__UCLIBC_SUBLEVEL__)
+#define VERSION __stringify(__UCLIBC_MAJOR__) "." __stringify(__UCLIBC_MINOR__) "." __stringify(__UCLIBC_SUBLEVEL__)
 
 #endif

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -19,7 +19,7 @@
 
 #include <limits.h>
 
-extern inline int __libc_use_alloca (size_t size)
+__extern_always_inline int __libc_use_alloca (size_t size)
 {
   return (__builtin_expect (size <= PTHREAD_STACK_MIN / 4, 1)
 	  || __libc_alloca_cutoff (size));

Modified: branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S	2008-11-17 09:45:29 UTC (rev 24072)
@@ -19,6 +19,7 @@
 #include <sysdep-cancel.h>
 #define _ERRNO_H	1
 #include <bits/errno.h>
+#include <sys/syscall.h>
 
 /* Clone the calling process, but without copying the whole address space.
    The calling process is suspended until the new process exits or is
@@ -39,12 +40,12 @@
 	bf	.Lhidden_fork
 
 	mov.w	.L1, r3
-	trapa	#0x10
+	trapa	#__SH_SYSCALL_TRAP_BASE
 	mov     r0, r1
 	mov	#-12, r2
 	shad	r2, r1
-	not	r1, r1			// r1=0 means r0 = -1 to -4095
-	tst	r1, r1			// i.e. error in linux
+	not	r1, r1			/* r1=0 means r0 = -1 to -4095 */
+	tst	r1, r1			/* i.e. error in linux */
 	bf	.Lpseudo_end
 	SYSCALL_ERROR_HANDLER
 .Lpseudo_end:
@@ -63,7 +64,7 @@
 	.long	pthread_create
 #endif
 
-.Lhidden_fork:	
+.Lhidden_fork:
 	mov.l	.L2, r1
 	braf	r1
 	 nop

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/Makefile.in	2008-11-17 09:45:29 UTC (rev 24072)
@@ -1,7 +1,7 @@
 # Makefile for uClibc
 #
 # Copyright (C) 2003 Paul Mundt <lethal at linux-sh.org>
-# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
@@ -71,9 +71,6 @@
 
 lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
 lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
-objclean-y += libpthread_clean
-headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
-headers_clean-y += linuxthreads_headers_clean
 
 #ifeq ($(DOMULTI),n)
 $(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend)
@@ -111,13 +108,16 @@
 	$(do_ln) ../$(PTDIR)/$(@F) $(top_builddir)$@
 include/bits/pthreadtypes.h: | include/bits
 	$(do_ln) ../../$(PTDIR)/sysdeps/pthread/bits/$(@F) $(top_builddir)$@
-linuxthreads_headers: include/pthread.h include/semaphore.h \
+
+linuxthreads_headers := include/pthread.h include/semaphore.h \
 			include/bits/pthreadtypes.h
+$(linuxthreads_headers): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+headers-$(UCLIBC_HAS_THREADS) += $(linuxthreads_headers)
 
+objclean-y += libpthread_clean
+headers_clean-y += linuxthreads_headers_clean
 linuxthreads_headers_clean:
-	$(RM) $(top_builddir)include/pthread.h \
-		$(top_builddir)include/semaphore.h \
-		$(top_builddir)include/bits/pthreadtypes.h
+	$(do_rm) $(addprefix $(top_builddir),$(linuxthreads_headers))
 
 libpthread_clean:
-	$(RM) $(libpthread_OUT)/*.{o,os,oS,a}
+	$(do_rm) $(addprefix $(libpthread_OUT)/*., o os oS a)

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/forward.c	2008-11-17 09:45:29 UTC (rev 24072)
@@ -23,20 +23,21 @@
 
 /* psm: keep this before internals.h */
 libc_hidden_proto(exit)
-/* vda: here's why:
+#if 0
+vda: here is why:
 In libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h
 adding libc_hidden_proto(foo) just before weak_extern (__pthread_initialize)
 will not warn:
-    //libc_hidden_proto(foo)
+    /* libc_hidden_proto(foo) */
     weak_extern (__pthread_initialize)
-    //libc_hidden_proto(foo)
+    /* libc_hidden_proto(foo) */
 but adding after will! Which is extremely strange -
 weak_extern expands into just "#pragma weak __pthread_initialize".
 TODO: determine whether it is a gcc bug or what
-(see gcc.gnu.org/bugzilla/show_bug.cgi?id=36282).
+(see gcc.gnu.org/PR36282).
 For now, just include all headers before internals.h
 (they are again included in internals.h - maybe remove them there later)
-*/
+#endif
 #include <string.h>
 #include <limits.h>
 #include <setjmp.h>

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/internals.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/internals.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/internals.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -36,9 +36,7 @@
 
 /* Use a funky version in a probably vein attempt at preventing gdb
  * from dlopen()'ing glibc's libthread_db library... */
-#define STRINGIFY(s) STRINGIFY2 (s)
-#define STRINGIFY2(s) #s
-#define VERSION STRINGIFY(__UCLIBC_MAJOR__) "." STRINGIFY(__UCLIBC_MINOR__) "." STRINGIFY(__UCLIBC_SUBLEVEL__)
+#define VERSION __stringify(__UCLIBC_MAJOR__) "." __stringify(__UCLIBC_MINOR__) "." __stringify(__UCLIBC_SUBLEVEL__)
 
 #ifndef THREAD_GETMEM
 # define THREAD_GETMEM(descr, member) descr->member

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/ptfork.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/ptfork.c	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/ptfork.c	2008-11-17 09:45:29 UTC (rev 24072)
@@ -20,6 +20,7 @@
 
 #ifdef __ARCH_USE_MMU__
 
+#include <bits/uClibc_mutex.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -36,6 +37,16 @@
 static struct handler_list * pthread_atfork_parent = NULL;
 static struct handler_list * pthread_atfork_child = NULL;
 
+#ifdef __MALLOC__
+__UCLIBC_MUTEX_EXTERN(__malloc_heap_lock);
+__UCLIBC_MUTEX_EXTERN(__malloc_sbrk_lock);
+#ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
+__UCLIBC_MUTEX_EXTERN(__malloc_mmb_heap_lock);
+#endif
+#elif defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__)
+__UCLIBC_MUTEX_EXTERN(__malloc_lock);
+#endif
+
 static void pthread_insert_list(struct handler_list ** list,
                                 void (*handler)(void),
                                 struct handler_list * newlist,
@@ -78,6 +89,10 @@
   for (/*nothing*/; list != NULL; list = list->next) (list->handler)();
 }
 
+void __pthread_once_fork_prepare(void);
+void __pthread_once_fork_child(void);
+void __pthread_once_fork_parent(void);
+
 extern __typeof(fork) __libc_fork;
 
 pid_t __fork(void) attribute_hidden;
@@ -90,14 +105,47 @@
   prepare = pthread_atfork_prepare;
   child = pthread_atfork_child;
   parent = pthread_atfork_parent;
-  __pthread_mutex_unlock(&pthread_atfork_lock);
   pthread_call_handlers(prepare);
+
+  __pthread_once_fork_prepare();
+#ifdef __MALLOC__
+  __pthread_mutex_lock(&__malloc_sbrk_lock);
+  __pthread_mutex_lock(&__malloc_heap_lock);
+#ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
+  __pthread_mutex_lock(&__malloc_mmb_heap_lock);
+#endif
+#elif defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__)
+  __pthread_mutex_lock(&__malloc_lock);
+#endif
+
   pid = __libc_fork();
   if (pid == 0) {
+#if defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__)
+    __libc_lock_init_recursive(__malloc_lock);
+#elif defined(__MALLOC__)
+#ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
+    __libc_lock_init_adaptive(__malloc_mmb_heap_lock);
+#endif
+    __libc_lock_init_adaptive(__malloc_heap_lock);
+    __libc_lock_init(__malloc_sbrk_lock);
+#endif
+    __libc_lock_init_adaptive(pthread_atfork_lock);
     __pthread_reset_main_thread();
     __fresetlockfiles();
+    __pthread_once_fork_child();
     pthread_call_handlers(child);
   } else {
+#if defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__)
+    __pthread_mutex_unlock(&__malloc_lock);
+#elif defined(__MALLOC__)
+#ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__
+    __pthread_mutex_unlock(&__malloc_mmb_heap_lock);
+#endif
+    __pthread_mutex_unlock(&__malloc_heap_lock);
+    __pthread_mutex_unlock(&__malloc_sbrk_lock);
+#endif
+    __pthread_mutex_unlock(&pthread_atfork_lock);
+    __pthread_once_fork_parent();
     pthread_call_handlers(parent);
   }
   return pid;

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/pthread.c	2008-11-17 09:45:29 UTC (rev 24072)
@@ -477,12 +477,12 @@
   __libc_sigaction(__pthread_sig_restart, &sa, NULL);
   sa.sa_handler = pthread_handle_sigcancel;
   sigaddset(&sa.sa_mask, __pthread_sig_restart);
-  // sa.sa_flags = 0;
+  /* sa.sa_flags = 0; */
   __libc_sigaction(__pthread_sig_cancel, &sa, NULL);
   if (__pthread_sig_debug > 0) {
       sa.sa_handler = pthread_handle_sigdebug;
       sigemptyset(&sa.sa_mask);
-      // sa.sa_flags = 0;
+      /* sa.sa_flags = 0; */
       __libc_sigaction(__pthread_sig_debug, &sa, NULL);
   }
   /* Initially, block __pthread_sig_restart. Will be unblocked on demand. */
@@ -530,7 +530,7 @@
 	 __pthread_manager_thread_bos, __pthread_manager_thread_tos);
 #if 0
   PDEBUG("initial stack: estimate bos=%p, tos=%p\n",
-  	 __pthread_initial_thread_bos, __pthread_initial_thread_tos);
+	 __pthread_initial_thread_bos, __pthread_initial_thread_tos);
 #endif
 
   /* Setup pipe to communicate with thread manager */

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -15,7 +15,7 @@
 # define PT_EI __extern_always_inline
 #endif
 
-static inline int
+static __inline__ int
 _test_and_set (int *p, int v)
 {
 	int result;

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h	2008-11-17 09:45:29 UTC (rev 24072)
@@ -30,7 +30,7 @@
 /* Mutex type.  */
 #if defined(_LIBC) || defined(_IO_MTSAFE_IO)
 typedef pthread_mutex_t __libc_lock_t;
-typedef struct { pthread_mutex_t mutex; } __libc_lock_recursive_t;
+typedef pthread_mutex_t __libc_lock_recursive_t;
 # ifdef __USE_UNIX98
 typedef pthread_rwlock_t __libc_rwlock_t;
 # else
@@ -132,15 +132,39 @@
 #define __libc_rwlock_init(NAME) \
   (__libc_maybe_call (__pthread_rwlock_init, (&(NAME), NULL), 0));
 
+/* Same as last but this time we initialize an adaptive mutex.  */
+#if defined _LIBC && !defined NOT_IN_libc && defined SHARED
+#define __libc_lock_init_adaptive(NAME) \
+  ({									      \
+    (NAME).__m_count = 0;						      \
+    (NAME).__m_owner = NULL;						      \
+    (NAME).__m_kind = PTHREAD_MUTEX_ADAPTIVE_NP;			      \
+    (NAME).__m_lock.__status = 0;					      \
+    (NAME).__m_lock.__spinlock = __LT_SPINLOCK_INIT;			      \
+    0; })
+#else
+#define __libc_lock_init_adaptive(NAME) \
+  do {									      \
+    if (__pthread_mutex_init != NULL)					      \
+      {									      \
+	pthread_mutexattr_t __attr;					      \
+	__pthread_mutexattr_init (&__attr);				      \
+	__pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_ADAPTIVE_NP);     \
+	__pthread_mutex_init (&(NAME), &__attr);			      \
+	__pthread_mutexattr_destroy (&__attr);				      \
+      }									      \
+  } while (0);
+#endif
+
 /* Same as last but this time we initialize a recursive mutex.  */
 #if defined _LIBC && !defined NOT_IN_libc && defined SHARED
 #define __libc_lock_init_recursive(NAME) \
   ({									      \
-    (NAME).mutex.__m_count = 0;						      \
-    (NAME).mutex.__m_owner = NULL;					      \
-    (NAME).mutex.__m_kind = PTHREAD_MUTEX_RECURSIVE_NP;			      \
-    (NAME).mutex.__m_lock.__status = 0;					      \
-    (NAME).mutex.__m_lock.__spinlock = __LT_SPINLOCK_INIT;		      \
+    (NAME).__m_count = 0;						      \
+    (NAME).__m_owner = NULL;					      \
+    (NAME).__m_kind = PTHREAD_MUTEX_RECURSIVE_NP;			      \
+    (NAME).__m_lock.__status = 0;					      \
+    (NAME).__m_lock.__spinlock = __LT_SPINLOCK_INIT;		      \
     0; })
 #else
 #define __libc_lock_init_recursive(NAME) \
@@ -150,7 +174,7 @@
 	pthread_mutexattr_t __attr;					      \
 	__pthread_mutexattr_init (&__attr);				      \
 	__pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \
-	__pthread_mutex_init (&(NAME).mutex, &__attr);			      \
+	__pthread_mutex_init (&(NAME), &__attr);			      \
 	__pthread_mutexattr_destroy (&__attr);				      \
       }									      \
   } while (0);

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch	2008-11-17 09:45:29 UTC (rev 24072)
@@ -1,7 +1,7 @@
 # Makefile for uClibc
 #
 # Copyright (C) 2003 Paul Mundt <lethal at linux-sh.org>
-# Copyright (C) 2000-2005 Erik Andersen <andersen at uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
@@ -27,4 +27,4 @@
 	$(compile.c:32media=compact)
 
 libpthread_arch_objclean:
-	$(RM) $(libpthread_ARCH_OUT)/*.{o,os}
+	$(do_rm) $(addprefix $(libpthread_ARCH_OUT)/*., o os)

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old/wrapsyscall.c
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old/wrapsyscall.c	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old/wrapsyscall.c	2008-11-17 09:45:29 UTC (rev 24072)
@@ -96,7 +96,8 @@
 		    (fd, offset, whence))
 #endif
 
-#ifdef __NR_msync
+#if defined(__NR_msync) && defined(__ARCH_USE_MMU__)
+
 /* msync(2).  */
 CANCELABLE_SYSCALL (int, msync, (void *addr, size_t length, int flags),
 		    (addr, length, flags))
@@ -182,7 +183,7 @@
 CANCELABLE_SYSCALL (ssize_t, write, (int fd, const void *buf, size_t n),
 		    (fd, buf, n))
 
-
+#if defined __UCLIBC_HAS_SOCKET__
 /* The following system calls are thread cancellation points specified
    in XNS.  */
 
@@ -224,3 +225,4 @@
 				      int flags, __CONST_SOCKADDR_ARG addr,
 				      socklen_t addr_len),
 		    (fd, buf, n, flags, addr, addr_len))
+#endif /* __UCLIBC_HAS_SOCKET__ */

Modified: branches/uClibc-nptl/libpthread/linuxthreads.old_db/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads.old_db/Makefile.in	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads.old_db/Makefile.in	2008-11-17 09:45:29 UTC (rev 24072)
@@ -1,6 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
@@ -33,9 +33,6 @@
 
 lib-a-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.a
 lib-so-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.so
-objclean-y += libthread_db_clean
-headers-$(PTHREADS_DEBUG_SUPPORT) += linuxthreads_db_headers
-headers_clean-y += linuxthreads_db_headers_clean
 
 #ifeq ($(DOMULTI),n)
 ifeq ($(DOPIC),y)
@@ -62,11 +59,18 @@
 	$(Q)$(RM) $@
 	$(do_ar)
 
-linuxthreads_db_headers:
-	$(Q)$(LN) -sf ../$(PTDIR)_db/thread_db.h $(top_builddir)include/
+include/thread_db.h:
+	$(do_ln) ../$(PTDIR)_db/$(@F) $(top_builddir)$@
 
+linuxthreads_db_headers := include/thread_db.h
+$(linuxthreads_db_headers): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+headers-$(PTHREADS_DEBUG_SUPPORT) += $(linuxthreads_db_headers)
+
+objclean-y += libthread_db_clean
+headers_clean-y += linuxthreads_db_headers_clean
+
 linuxthreads_db_headers_clean:
-	$(RM) $(top_builddir)include/thread_db.h
+	$(do_rm) $(top_builddir)include/thread_db.h
 
 libthread_db_clean:
-	$(RM) $(libthread_db_OUT)/*.{o,os,oS,a}
+	$(do_rm) $(addprefix $(libthread_db_OUT)/*., o os oS a)

Modified: branches/uClibc-nptl/libpthread/linuxthreads_db/Makefile.in
===================================================================
--- branches/uClibc-nptl/libpthread/linuxthreads_db/Makefile.in	2008-11-17 09:34:35 UTC (rev 24071)
+++ branches/uClibc-nptl/libpthread/linuxthreads_db/Makefile.in	2008-11-17 09:45:29 UTC (rev 24072)
@@ -1,6 +1,6 @@
 # Makefile for uClibc
 #
-# Copyright (C) 2000-2006 Erik Andersen <andersen at uclibc.org>
+# Copyright (C) 2000-2008 Erik Andersen <andersen at uclibc.org>
 #
 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 #
@@ -33,9 +33,6 @@
 
 lib-a-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.a
 lib-so-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.so
-objclean-y += libthread_db_clean
-headers-$(PTHREADS_DEBUG_SUPPORT) += linuxthreads_db_headers
-headers_clean-y += linuxthreads_db_headers_clean
 
 #ifeq ($(DOMULTI),n)
 ifeq ($(DOPIC),y)
@@ -62,11 +59,18 @@
 	$(Q)$(RM) $@
 	$(do_ar)
 
-linuxthreads_db_headers:
-	$(Q)$(LN) -sf ../$(PTDIR)_db/thread_db.h $(top_builddir)include/
+include/thread_db.h:
+	$(do_ln) ../$(PTDIR)_db/$(@F) $(top_builddir)$@
 
+linuxthreads_db_headers := include/thread_db.h
+$(linuxthreads_db_headers): $(wildcard $(addprefix include/config/linuxthreads/,old.h new.h))
+headers-$(PTHREADS_DEBUG_SUPPORT) += $(linuxthreads_db_headers)
+
+objclean-y += libthread_db_clean
+headers_clean-y += linuxthreads_db_headers_clean
+
 linuxthreads_db_headers_clean:
-	$(RM) $(top_builddir)include/thread_db.h
+	$(do_rm) $(top_builddir)include/thread_db.h
 
 libthread_db_clean:
-	$(RM) $(libthread_db_OUT)/*.{o,os,oS,a}
+	$(do_rm) $(addprefix $(libthread_db_OUT)/*., o os oS a)




More information about the uClibc-cvs mailing list