diff options
20 files changed, 169 insertions, 77 deletions
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in index fe29f2cd1..d504b9999 100644 --- a/libpthread/linuxthreads.old/Makefile.in +++ b/libpthread/linuxthreads.old/Makefile.in @@ -1,7 +1,7 @@ # Makefile for uClibc # # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> -# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # @@ -71,9 +71,6 @@ libpthread-so-y += $(libpthread_OBJ:.o=.os) $(libpthread-shared-y) 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 @@ include/semaphore.h: $(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) diff --git a/libpthread/linuxthreads.old/forward.c b/libpthread/linuxthreads.old/forward.c index eeaefd7a3..5dc9cf4c0 100644 --- a/libpthread/linuxthreads.old/forward.c +++ b/libpthread/linuxthreads.old/forward.c @@ -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> diff --git a/libpthread/linuxthreads.old/internals.h b/libpthread/linuxthreads.old/internals.h index 38290a5fe..0cb97357c 100644 --- a/libpthread/linuxthreads.old/internals.h +++ b/libpthread/linuxthreads.old/internals.h @@ -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 diff --git a/libpthread/linuxthreads.old/ptfork.c b/libpthread/linuxthreads.old/ptfork.c index c34ea8104..7a5749efc 100644 --- a/libpthread/linuxthreads.old/ptfork.c +++ b/libpthread/linuxthreads.old/ptfork.c @@ -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_prepare = NULL; 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 @@ static __inline__ void pthread_call_handlers(struct handler_list * list) 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 @@ pid_t __fork(void) 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; diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index 35de4b731..e96f3ab6a 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -477,12 +477,12 @@ static void pthread_initialize(void) __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 @@ int __pthread_initialize_manager(void) __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 */ diff --git a/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h b/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h index cd45d5faf..5735d0ea2 100644 --- a/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h +++ b/libpthread/linuxthreads.old/sysdeps/avr32/pt-machine.h @@ -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; diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h index 740e793be..78593ac11 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-lock.h @@ -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 @@ typedef pthread_key_t __libc_key_t; #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 @@ typedef pthread_key_t __libc_key_t; 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); diff --git a/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch b/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch index e4cb95b76..bf57e803c 100644 --- a/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch +++ b/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch @@ -1,7 +1,7 @@ # Makefile for uClibc # # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> -# Copyright (C) 2000-2005 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # @@ -27,4 +27,4 @@ $(libpthread_ARCH_OBJ:.o=.os): %.os : %.c $(compile.c:32media=compact) libpthread_arch_objclean: - $(RM) $(libpthread_ARCH_OUT)/*.{o,os} + $(do_rm) $(addprefix $(libpthread_ARCH_OUT)/*., o os) diff --git a/libpthread/linuxthreads.old/wrapsyscall.c b/libpthread/linuxthreads.old/wrapsyscall.c index c1ddcb8fe..713e7e548 100644 --- a/libpthread/linuxthreads.old/wrapsyscall.c +++ b/libpthread/linuxthreads.old/wrapsyscall.c @@ -96,7 +96,8 @@ CANCELABLE_SYSCALL (off64_t, lseek64, (int fd, off64_t offset, int whence), (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 @@ libpthread_hidden_def(waitpid) 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 @@ CANCELABLE_SYSCALL (ssize_t, sendto, (int fd, const __ptr_t buf, size_t n, int flags, __CONST_SOCKADDR_ARG addr, socklen_t addr_len), (fd, buf, n, flags, addr, addr_len)) +#endif /* __UCLIBC_HAS_SOCKET__ */ diff --git a/libpthread/linuxthreads.old_db/Makefile.in b/libpthread/linuxthreads.old_db/Makefile.in index e99d4ddfc..1c89a9f0e 100644 --- a/libpthread/linuxthreads.old_db/Makefile.in +++ b/libpthread/linuxthreads.old_db/Makefile.in @@ -1,6 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # @@ -33,9 +33,6 @@ endif 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 @@ $(top_builddir)lib/libthread_db.a: $(libthread_db-a-y) $(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) diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in index b7c8914f5..947dea917 100644 --- a/libpthread/linuxthreads/Makefile.in +++ b/libpthread/linuxthreads/Makefile.in @@ -1,7 +1,7 @@ # Makefile for uClibc # # Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> -# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # @@ -81,9 +81,6 @@ libpthread-so-y += $(libpthread_OBJ:.o=.oS) 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 @@ include/semaphore.h: $(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)))) diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index 4c44252ab..36961a1c9 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -45,11 +45,12 @@ extern __typeof(sigaction) __libc_sigaction; 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 @@ struct _pthread_descr_struct __pthread_initial_thread = { #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 @@ static void pthread_initialize(void) #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 @@ static void pthread_initialize(void) __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 @@ void __pthread_reset_main_thread(void) /* 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 diff --git a/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h b/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h index b93bc47f0..5735d0ea2 100644 --- a/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h +++ b/libpthread/linuxthreads/sysdeps/avr32/pt-machine.h @@ -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 @@ register char * stack_pointer __asm__ ("sp"); 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" diff --git a/libpthread/linuxthreads/sysdeps/i386/pt-machine.h b/libpthread/linuxthreads/sysdeps/i386/pt-machine.h index f96452599..a4557891d 100644 --- a/libpthread/linuxthreads/sysdeps/i386/pt-machine.h +++ b/libpthread/linuxthreads/sysdeps/i386/pt-machine.h @@ -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) diff --git a/libpthread/linuxthreads/sysdeps/mips/pspinlock.c b/libpthread/linuxthreads/sysdeps/mips/pspinlock.c index a106c0f77..4d6617e1b 100644 --- a/libpthread/linuxthreads/sysdeps/mips/pspinlock.c +++ b/libpthread/linuxthreads/sysdeps/mips/pspinlock.c @@ -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) diff --git a/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h b/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h index 424922ec0..88a71828b 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h +++ b/libpthread/linuxthreads/sysdeps/pthread/kernel-features.h @@ -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 diff --git a/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h b/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h index 92619e5b4..e5c577ffb 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h +++ b/libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h @@ -42,8 +42,6 @@ extern int __cxa_atexit (void (*func) (void *), void *arg, void *d); /* 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 diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h index f62f7d6e9..a3f303ca3 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h @@ -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)); diff --git a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S index f230c0122..e933eefde 100644 --- a/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S +++ b/libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S @@ -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 @@ ENTRY (__vfork) 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 @@ ENTRY (__vfork) .long pthread_create #endif -.Lhidden_fork: +.Lhidden_fork: mov.l .L2, r1 braf r1 nop diff --git a/libpthread/linuxthreads_db/Makefile.in b/libpthread/linuxthreads_db/Makefile.in index a611c6ee0..a57cb8461 100644 --- a/libpthread/linuxthreads_db/Makefile.in +++ b/libpthread/linuxthreads_db/Makefile.in @@ -1,6 +1,6 @@ # Makefile for uClibc # -# Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> +# Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org> # # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. # @@ -33,9 +33,6 @@ endif 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 @@ $(top_builddir)lib/libthread_db.a: $(libthread_db-a-y) $(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) |