summaryrefslogtreecommitdiffstats
path: root/libpthread/linuxthreads
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-11-17 09:45:29 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-11-17 09:45:29 +0000
commit9584b4e582b293ead79d8bb0ff85c1ef12a888d9 (patch)
tree7eaf3bc76dd05e6d9a9c7002e7a9d5e23d5cd5fd /libpthread/linuxthreads
parentcf8c7b558c1c33cafe557ced361554461485af6c (diff)
downloaduClibc-alpine-9584b4e582b293ead79d8bb0ff85c1ef12a888d9.tar.bz2
uClibc-alpine-9584b4e582b293ead79d8bb0ff85c1ef12a888d9.tar.xz
Synch with trunk @ 24071.
Step 1 linuxthreads - linuxthreads_db - linuxthread.old - linuxthreads.old_db
Diffstat (limited to 'libpthread/linuxthreads')
-rw-r--r--libpthread/linuxthreads/Makefile.in18
-rw-r--r--libpthread/linuxthreads/pthread.c15
-rw-r--r--libpthread/linuxthreads/sysdeps/avr32/pt-machine.h6
-rw-r--r--libpthread/linuxthreads/sysdeps/i386/pt-machine.h3
-rw-r--r--libpthread/linuxthreads/sysdeps/mips/pspinlock.c2
-rw-r--r--libpthread/linuxthreads/sysdeps/pthread/kernel-features.h8
-rw-r--r--libpthread/linuxthreads/sysdeps/pthread/uClibc-glue.h4
-rw-r--r--libpthread/linuxthreads/sysdeps/unix/sysv/linux/allocalim.h2
-rw-r--r--libpthread/linuxthreads/sysdeps/unix/sysv/linux/sh/vfork.S9
9 files changed, 39 insertions, 28 deletions
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