summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libpthread/nptl/Makefile.in17
-rw-r--r--libpthread/nptl/cancellation.c2
-rw-r--r--libpthread/nptl/cleanup.c2
-rw-r--r--libpthread/nptl/forward.c16
-rw-r--r--libpthread/nptl/init.c3
-rw-r--r--libpthread/nptl/pt-system.c2
-rw-r--r--libpthread/nptl/pthreadP.h26
-rw-r--r--libpthread/nptl/pthread_atfork.c5
-rw-r--r--libpthread/nptl/pthread_cancel.c10
-rw-r--r--libpthread/nptl/sysdeps/generic/Makefile.in2
-rw-r--r--libpthread/nptl/sysdeps/generic/dl-support.c2
-rw-r--r--libpthread/nptl/sysdeps/generic/libc-tls.c4
-rw-r--r--libpthread/nptl/sysdeps/mips/Makefile.arch2
-rw-r--r--libpthread/nptl/sysdeps/mips/sysdep.h31
-rw-r--r--libpthread/nptl/sysdeps/pthread/Makefile.in2
-rw-r--r--libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h1
-rw-r--r--libpthread/nptl/sysdeps/pthread/pt-longjmp.c2
-rw-r--r--libpthread/nptl/sysdeps/pthread/pthread.h3
-rw-r--r--libpthread/nptl/sysdeps/pthread/sigaction.c8
-rw-r--r--libpthread/nptl/sysdeps/pthread/sigprocmask.c1
-rw-r--r--libpthread/nptl/sysdeps/pthread/unwind-resume.c10
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in101
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/fork.c13
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c14
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c3
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch5
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c1
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c9
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/raise.c7
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c4
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c150
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c2
-rw-r--r--libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c2
-rw-r--r--libpthread/nptl/unwind.c2
36 files changed, 226 insertions, 243 deletions
diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in
index 84a1cd124..9761f9670 100644
--- a/libpthread/nptl/Makefile.in
+++ b/libpthread/nptl/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for uClibc NPTL
#
-# Copyright (C) 2005 Steven J. Hill <sjhill@realitydiluted.com>
+# Copyright (C) 2005-2006 Steven J. Hill <sjhill@realitydiluted.com>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
@@ -223,6 +223,8 @@ libpthread_FULL_NAME := libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL)
PTHREAD_DIR := $(top_srcdir)libpthread/nptl
PTHREAD_OUT := $(top_builddir)libpthread/nptl
+libpthread_static_SRC := pthread_atfork
+
libpthread_a_SRC = $(patsubst %, $(PTHREAD_DIR)/%.c, \
$(filter-out $(libpthread-os-routines) \
$(libpthread-misc-routines) \
@@ -232,13 +234,15 @@ libpthread_so_SRC = $(patsubst %, $(PTHREAD_DIR)/%.c, \
$(filter-out $(libpthread-os-routines) \
$(libpthread-misc-routines), $(libpthread-routines)))
-libc-a-y += $(patsubst %.c, $(PTHREAD_OUT)/%.o, alloca_cutoff.c \
+libc-static-y += $(patsubst %.c, $(PTHREAD_OUT)/%.o, alloca_cutoff.c \
forward.c libc-cancellation.c)
-libc-so-y += $(patsubst %.c, $(PTHREAD_OUT)/%.oS, forward.c \
+libc-shared-y += $(patsubst %.c, $(PTHREAD_OUT)/%.oS, forward.c \
libc-cancellation.c)
+libpthread-nonshared-y += $(patsubst %,$(PTHREAD_OUT)/%.oS,$(libpthread_static_SRC))
libpthread-a-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.o,$(libpthread_a_SRC))
libpthread-so-y := $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.oS,$(libpthread_so_SRC))
+libpthread-static-y += $(patsubst $(PTHREAD_DIR)/%.c,$(PTHREAD_OUT)/%.o,$(libpthread_a_SRC) $(libpthread_static_SRC))
objclean-y += libpthread_clean
headers_clean-y += nptl_headers_clean
@@ -252,8 +256,11 @@ headers_clean-y += nptl_headers_clean
lib-a-y += $(top_builddir)lib/libpthread.a
lib-so-y += $(top_builddir)lib/libpthread.so
-$(top_builddir)lib/libpthread.so: $(PTHREAD_OUT)/libpthread_so.a
+$(top_builddir)lib/libpthread.so: $(PTHREAD_OUT)/libpthread_so.a $(libc) $(top_builddir)lib/libpthread_nonshared.a
$(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
+ $(Q)$(RM) $@
+ $(Q)cp $(top_srcdir)extra/scripts/format.lds $@
+ $(Q)echo "GROUP ( $(notdir $@).$(MAJOR_VERSION) libpthread_nonshared.a )" >> $@
$(PTHREAD_OUT)/libpthread_so.a: $(libpthread-so-y)
$(Q)$(RM) $@
@@ -298,7 +305,9 @@ nptl_headers:
$(LN) -sf ../../$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/pthreadtypes.h $(top_builddir)include/bits/
$(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/libc-lock.h $(top_builddir)include/bits/
$(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/stdio-lock.h $(top_builddir)include/bits/
+ifeq ($(shell $(CC) --help >& /dev/null && echo yes),yes)
$(MAKE) $(PTHREAD_OUT)/pthread-errnos.h
+endif
nptl_headers_clean:
$(RM) $(PTDIR)/banner.h $(top_builddir)include/pthread.h \
diff --git a/libpthread/nptl/cancellation.c b/libpthread/nptl/cancellation.c
index 1d28d383f..59e16b9e1 100644
--- a/libpthread/nptl/cancellation.c
+++ b/libpthread/nptl/cancellation.c
@@ -32,6 +32,7 @@ __pthread_enable_asynccancel (void)
struct pthread *self = THREAD_SELF;
int oldval = THREAD_GETMEM (self, cancelhandling);
+//printf("%s\n", __FUNCTION__);
while (1)
{
int newval = oldval | CANCELTYPE_BITMASK;
@@ -64,6 +65,7 @@ void
internal_function attribute_hidden
__pthread_disable_asynccancel (int oldtype)
{
+//printf("%s\n", __FUNCTION__);
/* If asynchronous cancellation was enabled before we do not have
anything to do. */
if (oldtype & CANCELTYPE_BITMASK)
diff --git a/libpthread/nptl/cleanup.c b/libpthread/nptl/cleanup.c
index 5bf85398e..af828c49f 100644
--- a/libpthread/nptl/cleanup.c
+++ b/libpthread/nptl/cleanup.c
@@ -35,6 +35,7 @@ __pthread_register_cancel (__pthread_unwind_buf_t *buf)
/* Store the new cleanup handler info. */
THREAD_SETMEM (self, cleanup_jmp_buf, (struct pthread_unwind_buf *) buf);
}
+hidden_def (__pthread_register_cancel)
void
@@ -45,3 +46,4 @@ __pthread_unregister_cancel (__pthread_unwind_buf_t *buf)
THREAD_SETMEM (THREAD_SELF, cleanup_jmp_buf, ibuf->priv.data.prev);
}
+hidden_def (__pthread_unregister_cancel)
diff --git a/libpthread/nptl/forward.c b/libpthread/nptl/forward.c
index b0ca3aee9..843096841 100644
--- a/libpthread/nptl/forward.c
+++ b/libpthread/nptl/forward.c
@@ -126,16 +126,24 @@ FORWARD (pthread_mutex_destroy, (pthread_mutex_t *mutex), (mutex), 0)
FORWARD (pthread_mutex_init,
(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr),
(mutex, mutexattr), 0)
-hidden_strong_alias(pthread_mutex_init, __pthread_mutex_init)
+libc_hidden_proto(pthread_mutex_init)
+strong_alias(pthread_mutex_init, __pthread_mutex_init)
+libc_hidden_def(pthread_mutex_init)
FORWARD (pthread_mutex_trylock, (pthread_mutex_t *mutex), (mutex), 0)
-hidden_strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock)
+libc_hidden_proto(pthread_mutex_trylock)
+strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock)
+libc_hidden_def(pthread_mutex_trylock)
FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0)
-hidden_strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
+libc_hidden_proto(pthread_mutex_lock)
+strong_alias(pthread_mutex_lock, __pthread_mutex_lock)
+libc_hidden_def(pthread_mutex_lock)
FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0)
-hidden_strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
+libc_hidden_proto(pthread_mutex_unlock)
+strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock)
+libc_hidden_def(pthread_mutex_unlock)
FORWARD (pthread_mutexattr_init, (pthread_mutexattr_t *attr), (attr), 0)
diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c
index a5d24672a..ead1a3fba 100644
--- a/libpthread/nptl/init.c
+++ b/libpthread/nptl/init.c
@@ -67,6 +67,9 @@ static const char nptl_version[] __attribute_used__ = VERSION;
extern void __libc_setup_tls (size_t tcbsize, size_t tcbalign);
#endif
+int
+__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact);
+
#ifdef SHARED
static const struct pthread_functions pthread_functions =
diff --git a/libpthread/nptl/pt-system.c b/libpthread/nptl/pt-system.c
index 462fbf33a..b3b45ab93 100644
--- a/libpthread/nptl/pt-system.c
+++ b/libpthread/nptl/pt-system.c
@@ -26,7 +26,7 @@
int
system (const char *line)
{
- return system (line);
+ return __libc_system (line);
}
/* __libc_system in libc.so handles cancellation. */
diff --git a/libpthread/nptl/pthreadP.h b/libpthread/nptl/pthreadP.h
index da278bdb8..45222f45e 100644
--- a/libpthread/nptl/pthreadP.h
+++ b/libpthread/nptl/pthreadP.h
@@ -66,7 +66,7 @@ extern int __is_smp attribute_hidden;
/* Thread descriptor handling. */
extern list_t __stack_user;
-hidden_def(__stack_user)
+hidden_proto (__stack_user)
/* Attribute handling. */
extern struct pthread_attr *__attr_list attribute_hidden;
@@ -82,7 +82,7 @@ extern int __concurrency_level attribute_hidden;
/* Thread-local data key handling. */
extern struct pthread_key_struct __pthread_keys[PTHREAD_KEYS_MAX];
-hidden_def(__pthread_keys)
+hidden_proto (__pthread_keys)
/* Number of threads running. */
extern unsigned int __nptl_nthreads attribute_hidden;
@@ -134,6 +134,10 @@ extern void __pthread_register_cancel (__pthread_unwind_buf_t *__buf)
extern void __pthread_unregister_cancel (__pthread_unwind_buf_t *__buf)
__cleanup_fct_attribute;
#if defined NOT_IN_libc && defined IS_IN_libpthread
+hidden_proto (__pthread_unwind)
+hidden_proto (__pthread_unwind_next)
+hidden_proto (__pthread_register_cancel)
+hidden_proto (__pthread_unregister_cancel)
# ifdef SHARED
extern void attribute_hidden pthread_cancel_init (void);
# endif
@@ -170,22 +174,22 @@ __do_cancel (void)
# define LIBC_CANCEL_RESET(oldtype) \
__libc_disable_asynccancel (oldtype)
# define LIBC_CANCEL_HANDLED() \
- __asm (".globl " __C_SYMBOL_PREFIX__ "__libc_enable_asynccancel"); \
- __asm (".globl " __C_SYMBOL_PREFIX__ "__libc_disable_asynccancel")
+ __asm (".globl " __USER_LABEL_PREFIX__ "__libc_enable_asynccancel"); \
+ __asm (".globl " __USER_LABEL_PREFIX__ "__libc_disable_asynccancel")
#elif defined NOT_IN_libc && defined IS_IN_libpthread
# define LIBC_CANCEL_ASYNC() CANCEL_ASYNC ()
# define LIBC_CANCEL_RESET(val) CANCEL_RESET (val)
# define LIBC_CANCEL_HANDLED() \
- __asm (".globl " __C_SYMBOL_PREFIX__ "__pthread_enable_asynccancel"); \
- __asm (".globl " __C_SYMBOL_PREFIX__ "__pthread_disable_asynccancel")
+ __asm (".globl " __USER_LABEL_PREFIX__ "__pthread_enable_asynccancel"); \
+ __asm (".globl " __USER_LABEL_PREFIX__ "__pthread_disable_asynccancel")
#elif defined NOT_IN_libc && defined IS_IN_librt
# define LIBC_CANCEL_ASYNC() \
__librt_enable_asynccancel ()
# define LIBC_CANCEL_RESET(val) \
__librt_disable_asynccancel (val)
# define LIBC_CANCEL_HANDLED() \
- __asm (".globl " __C_SYMBOL_PREFIX__ "__librt_enable_asynccancel"); \
- __asm (".globl " __C_SYMBOL_PREFIX__ "__librt_disable_asynccancel")
+ __asm (".globl " __USER_LABEL_PREFIX__ "__librt_enable_asynccancel"); \
+ __asm (".globl " __USER_LABEL_PREFIX__ "__librt_disable_asynccancel")
#else
# define LIBC_CANCEL_ASYNC() 0 /* Just a dummy value. */
# define LIBC_CANCEL_RESET(val) ((void)(val)) /* Nothing, but evaluate it. */
@@ -234,7 +238,7 @@ extern int __make_stacks_executable (void **stack_endp)
/* longjmp handling. */
extern void __pthread_cleanup_upto (__jmp_buf target, char *targetframe);
#if defined NOT_IN_libc && defined IS_IN_libpthread
-hidden_def(__pthread_cleanup_upto)
+hidden_proto (__pthread_cleanup_upto)
#endif
@@ -252,8 +256,8 @@ extern int __pthread_attr_init_2_0 (pthread_attr_t *attr);
/* Event handlers for libthread_db interface. */
extern void __nptl_create_event (void);
extern void __nptl_death_event (void);
-hidden_def(__nptl_create_event)
-hidden_def(__nptl_death_event)
+hidden_proto (__nptl_create_event)
+hidden_proto (__nptl_death_event)
/* Register the generation counter in the libpthread with the libc. */
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
diff --git a/libpthread/nptl/pthread_atfork.c b/libpthread/nptl/pthread_atfork.c
index e0fc3cf75..491362e19 100644
--- a/libpthread/nptl/pthread_atfork.c
+++ b/libpthread/nptl/pthread_atfork.c
@@ -41,6 +41,9 @@
extern void *__dso_handle __attribute__ ((__weak__));
+/* Hide the symbol so that no definition but the one locally in the
+ executable or DSO is used. */
+int
__pthread_atfork (prepare, parent, child)
void (*prepare) (void);
void (*parent) (void);
@@ -49,4 +52,4 @@ __pthread_atfork (prepare, parent, child)
return __register_atfork (prepare, parent, child,
&__dso_handle == NULL ? NULL : __dso_handle);
}
-strong_alias (__pthread_atfork, pthread_atfork)
+strong_alias(__pthread_atfork, pthread_atfork)
diff --git a/libpthread/nptl/pthread_cancel.c b/libpthread/nptl/pthread_cancel.c
index a13af56b3..41543fd78 100644
--- a/libpthread/nptl/pthread_cancel.c
+++ b/libpthread/nptl/pthread_cancel.c
@@ -31,11 +31,13 @@ pthread_cancel (th)
{
volatile struct pthread *pd = (volatile struct pthread *) th;
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
/* Make sure the descriptor is valid. */
if (INVALID_TD_P (pd))
/* Not a valid thread handle. */
return ESRCH;
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
#ifdef SHARED
pthread_cancel_init ();
#endif
@@ -47,17 +49,20 @@ pthread_cancel (th)
oldval = pd->cancelhandling;
newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
/* Avoid doing unnecessary work. The atomic operation can
potentially be expensive if the bug has to be locked and
remote cache lines have to be invalidated. */
if (oldval == newval)
break;
+//printf("%s:%d newval = %x\n", __FUNCTION__, __LINE__, newval);
/* If the cancellation is handled asynchronously just send a
signal. We avoid this if possible since it's more
expensive. */
if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
{
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
/* Mark the cancellation as "in progress". */
atomic_bit_set (&pd->cancelhandling, CANCELING_BIT);
@@ -76,19 +81,23 @@ pthread_cancel (th)
val = INTERNAL_SYSCALL (tgkill, err, 3,
THREAD_GETMEM (THREAD_SELF, pid), pd->tid,
SIGCANCEL);
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
#else
# ifdef __NR_tgkill
val = INTERNAL_SYSCALL (tgkill, err, 3,
THREAD_GETMEM (THREAD_SELF, pid), pd->tid,
SIGCANCEL);
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
if (INTERNAL_SYSCALL_ERROR_P (val, err)
&& INTERNAL_SYSCALL_ERRNO (val, err) == ENOSYS)
# endif
val = INTERNAL_SYSCALL (tkill, err, 2, pd->tid, SIGCANCEL);
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
#endif
if (INTERNAL_SYSCALL_ERROR_P (val, err))
result = INTERNAL_SYSCALL_ERRNO (val, err);
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
break;
}
@@ -97,6 +106,7 @@ pthread_cancel (th)
atomically since other bits could be modified as well. */
while (atomic_compare_and_exchange_bool_acq (&pd->cancelhandling, newval,
oldval));
+//printf("%s:%d\n", __FUNCTION__, __LINE__);
return result;
}
diff --git a/libpthread/nptl/sysdeps/generic/Makefile.in b/libpthread/nptl/sysdeps/generic/Makefile.in
index 2d2a00d8e..79af336d2 100644
--- a/libpthread/nptl/sysdeps/generic/Makefile.in
+++ b/libpthread/nptl/sysdeps/generic/Makefile.in
@@ -21,7 +21,7 @@ PTHREAD_GENERIC_OUT:=$(top_builddir)libpthread/nptl/sysdeps/generic
LIBC_GENERIC_OBJ:=$(patsubst %.c,$(PTHREAD_GENERIC_OUT)/%.o,$(libc_a_CSRC))
-libc-a-y+=$(LIBC_GENERIC_OBJ)
+libc-static-y+=$(LIBC_GENERIC_OBJ)
libc-nomulti-y+=$(LIBC_GENERIC_OBJ)
diff --git a/libpthread/nptl/sysdeps/generic/dl-support.c b/libpthread/nptl/sysdeps/generic/dl-support.c
index 4d8ea6f8d..496694ca4 100644
--- a/libpthread/nptl/sysdeps/generic/dl-support.c
+++ b/libpthread/nptl/sysdeps/generic/dl-support.c
@@ -68,6 +68,6 @@ _dl_nothread_init_static_tls (struct link_map *map)
dtv[map->l_tls_modid].pointer.is_static = true;
/* Initialize the memory. */
- memset (__mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
+ memset (mempcpy (dest, map->l_tls_initimage, map->l_tls_initimage_size),
'\0', map->l_tls_blocksize - map->l_tls_initimage_size);
}
diff --git a/libpthread/nptl/sysdeps/generic/libc-tls.c b/libpthread/nptl/sysdeps/generic/libc-tls.c
index 8b662a433..3b58ce21f 100644
--- a/libpthread/nptl/sysdeps/generic/libc-tls.c
+++ b/libpthread/nptl/sysdeps/generic/libc-tls.c
@@ -147,10 +147,10 @@ __libc_setup_tls (size_t tcbsize, size_t tcbalign)
IE-model TLS. */
# if TLS_TCB_AT_TP
tcb_offset = roundup (memsz + GL(dl_tls_static_size), tcbalign);
- tlsblock = __sbrk (tcb_offset + tcbsize + max_align);
+ tlsblock = sbrk (tcb_offset + tcbsize + max_align);
# elif TLS_DTV_AT_TP
tcb_offset = roundup (tcbsize, align ?: 1);
- tlsblock = __sbrk (tcb_offset + memsz + max_align
+ tlsblock = sbrk (tcb_offset + memsz + max_align
+ TLS_PRE_TCB_SIZE + GL(dl_tls_static_size));
tlsblock += TLS_PRE_TCB_SIZE;
# else
diff --git a/libpthread/nptl/sysdeps/mips/Makefile.arch b/libpthread/nptl/sysdeps/mips/Makefile.arch
index fa22a5454..2613afd32 100644
--- a/libpthread/nptl/sysdeps/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/mips/Makefile.arch
@@ -31,7 +31,7 @@ libpthread-nomulti-y += $(PTHREAD_ARCH_OBJ)
LIBC_ARCH_OBJ := $(patsubst %.c,$(PTHREAD_ARCH_OUT)/%.o,$(libc_a_CSRC))
-libc-a-y += $(LIBC_ARCH_OBJ)
+libc-static-y += $(LIBC_ARCH_OBJ)
libc-nomulti-y += $(LIBC_ARCH_OBJ)
diff --git a/libpthread/nptl/sysdeps/mips/sysdep.h b/libpthread/nptl/sysdeps/mips/sysdep.h
index 9483d8b39..69cecae70 100644
--- a/libpthread/nptl/sysdeps/mips/sysdep.h
+++ b/libpthread/nptl/sysdeps/mips/sysdep.h
@@ -76,4 +76,35 @@
# define L(label) .L ## label
#endif
+/* Note that while it's better structurally, going back to call __syscall_error
+ can make things confusing if you're debugging---it looks like it's jumping
+ backwards into the previous fn. */
+#ifdef __PIC__
+#define PSEUDO(name, syscall_name, args) \
+ .align 2; \
+ 99: la t9,__syscall_error; \
+ jr t9; \
+ ENTRY(name) \
+ .set noreorder; \
+ .cpload t9; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, 99b; \
+L(syse1):
+#else
+#define PSEUDO(name, syscall_name, args) \
+ .set noreorder; \
+ .align 2; \
+ 99: j __syscall_error; \
+ nop; \
+ ENTRY(name) \
+ .set noreorder; \
+ li v0, SYS_ify(syscall_name); \
+ syscall; \
+ .set reorder; \
+ bne a3, zero, 99b; \
+L(syse1):
+#endif
+
#endif
diff --git a/libpthread/nptl/sysdeps/pthread/Makefile.in b/libpthread/nptl/sysdeps/pthread/Makefile.in
index a3043d5e2..a0ed8c00c 100644
--- a/libpthread/nptl/sysdeps/pthread/Makefile.in
+++ b/libpthread/nptl/sysdeps/pthread/Makefile.in
@@ -1,6 +1,6 @@
# Makefile for uClibc NPTL
#
-# Copyright (C) 2005 Steven J. Hill <sjhill@uclibc.org>
+# Copyright (C) 2005-2006 Steven J. Hill <sjhill@uclibc.org>
#
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
diff --git a/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h b/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h
index cd64bc37e..0caf40d7b 100644
--- a/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h
+++ b/libpthread/nptl/sysdeps/pthread/bits/stdio-lock.h
@@ -20,7 +20,6 @@
#ifndef _BITS_STDIO_LOCK_H
#define _BITS_STDIO_LOCK_H 1
-#include <bits/libc-lock.h>
#include <lowlevellock.h>
diff --git a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c b/libpthread/nptl/sysdeps/pthread/pt-longjmp.c
index f161380ea..b4106fdba 100644
--- a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c
+++ b/libpthread/nptl/sysdeps/pthread/pt-longjmp.c
@@ -21,6 +21,8 @@
#include <stdlib.h>
#include "pthreadP.h"
+extern void __libc_longjmp (sigjmp_buf env, int val)
+ __attribute__ ((noreturn));
void
longjmp (jmp_buf env, int val)
{
diff --git a/libpthread/nptl/sysdeps/pthread/pthread.h b/libpthread/nptl/sysdeps/pthread/pthread.h
index e2601c609..9090b30d9 100644
--- a/libpthread/nptl/sysdeps/pthread/pthread.h
+++ b/libpthread/nptl/sysdeps/pthread/pthread.h
@@ -28,6 +28,9 @@
#include <bits/pthreadtypes.h>
#include <setjmp.h>
#include <bits/wordsize.h>
+#if defined _LIBC && ( defined IS_IN_libc || defined NOT_IN_libc )
+#include <bits/uClibc_pthread.h>
+#endif
/* Detach state. */
diff --git a/libpthread/nptl/sysdeps/pthread/sigaction.c b/libpthread/nptl/sysdeps/pthread/sigaction.c
index 7524b3e34..17443654d 100644
--- a/libpthread/nptl/sysdeps/pthread/sigaction.c
+++ b/libpthread/nptl/sysdeps/pthread/sigaction.c
@@ -31,10 +31,7 @@
# include <sigaction.c>
int
-__sigaction (sig, act, oact)
- int sig;
- const struct sigaction *act;
- struct sigaction *oact;
+__sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
if (__builtin_expect (sig == SIGCANCEL || sig == SIGSETXID, 0))
{
@@ -44,7 +41,8 @@ __sigaction (sig, act, oact)
return __libc_sigaction (sig, act, oact);
}
-hidden_weak_alias(__sigaction, sigaction)
+libc_hidden_weak (__sigaction)
+weak_alias (__sigaction, sigaction)
#else
diff --git a/libpthread/nptl/sysdeps/pthread/sigprocmask.c b/libpthread/nptl/sysdeps/pthread/sigprocmask.c
index 7a3891d32..35aa843ba 100644
--- a/libpthread/nptl/sysdeps/pthread/sigprocmask.c
+++ b/libpthread/nptl/sysdeps/pthread/sigprocmask.c
@@ -17,5 +17,6 @@
02111-1307 USA. */
#include <pthreadP.h>
+#undef _LARGEFILE64_SOURCE
#include <../../../../libc/sysdeps/linux/common/sigprocmask.c>
diff --git a/libpthread/nptl/sysdeps/pthread/unwind-resume.c b/libpthread/nptl/sysdeps/pthread/unwind-resume.c
index 021024d49..594296723 100644
--- a/libpthread/nptl/sysdeps/pthread/unwind-resume.c
+++ b/libpthread/nptl/sysdeps/pthread/unwind-resume.c
@@ -19,6 +19,7 @@
#include <dlfcn.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unwind.h>
static void (*libgcc_s_resume) (struct _Unwind_Exception *exc);
@@ -29,14 +30,15 @@ static _Unwind_Reason_Code (*libgcc_s_personality)
static void
init (void)
{
- void *resume, *personality;
+ void *resume = NULL;
+ void *personality = NULL;
void *handle;
- handle = __libc_dlopen ("libgcc_s.so.1");
+ handle = dlopen ("libgcc_s.so.1", (RTLD_LOCAL | RTLD_LAZY));
if (handle == NULL
- || (resume = __libc_dlsym (handle, "_Unwind_Resume")) == NULL
- || (personality = __libc_dlsym (handle, "__gcc_personality_v0")) == NULL)
+ || (resume = dlsym (handle, "_Unwind_Resume")) == NULL
+ || (personality = dlsym (handle, "__gcc_personality_v0")) == NULL)
{
printf("libgcc_s.so.1 must be installed for pthread_cancel to work\n");
abort();
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
index a39ada190..0c73e61c2 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/Makefile.in
@@ -5,25 +5,38 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-libpthread_CSRC = pt-raise.c pthread_attr_getaffinity.c \
- pthread_attr_setaffinity.c pthread_getaffinity.c \
- pthread_getcpuclockid.c pthread_kill.c \
- pthread_mutex_cond_lock.c pthread_setaffinity.c \
- pthread_yield.c sem_post.c sem_timedwait.c \
- sem_trywait.c sem_wait.c pt-fork.c \
- sigtimedwait.c sigwaitinfo.c sigwait.c sleep.c
-
-libpthread_SSRC = #ptw-close.S ptw-open.S ptw-waitid.S ptw-waidpid.S ptw-write.S
-
-libc_CSRC = libc_pthread_init.c libc_multiple_threads.c \
- register-atfork.c unregister-atfork.c getpid.c \
- raise.c sleep.c
-
-libc_SSRC = #close.S open.S waitid.S waidpid.S write.S
+libpthread_CSRC := pt-raise.c pthread_attr_getaffinity.c \
+ pthread_attr_setaffinity.c pthread_getaffinity.c \
+ pthread_getcpuclockid.c pthread_kill.c \
+ pthread_mutex_cond_lock.c pthread_setaffinity.c \
+ pthread_yield.c sem_post.c sem_timedwait.c \
+ sem_trywait.c sem_wait.c pt-fork.c \
+ sigtimedwait.c sigwaitinfo.c pt-sigwait.c pt-sleep.c \
+ pt-msgsnd.c pt-msgrcv.c pt-waitpid.c pt-wait.c \
+ pt-open64.c pt-tcdrain.c pt-fcntl.c pt-pread_pwrite.c \
+ pt-llseek.c pt-fsync.c
+
+libpthread_SSRC := pt-close.S pt-open.S pt-read.S pt-write.S \
+ pt-nanosleep.S pt-pause.S pt-lseek.S pt-accept.S \
+ pt-connect.S pt-recv.S pt-recvfrom.S pt-recvmsg.S \
+ pt-send.S pt-sendmsg.S pt-sendto.S
+
+libc_CSRC := libc_pthread_init.c libc_multiple_threads.c \
+ register-atfork.c unregister-atfork.c getpid.c \
+ raise.c sleep.c
+
+libc_SSRC := exit-thread.S close.S open.S read.S write.S nanosleep.S \
+ creat.S pause.S msync.S lseek.S accept.S connect.S recv.S \
+ recvfrom.S recvmsg.S send.S sendmsg.S sendto.S
+
+librt_CSRC := mq_notify.c timer_create.c timer_delete.c \
+ timer_getoverr.c timer_gettime.c timer_routines.c \
+ timer_settime.c
ifeq ($(TARGET_ARCH),alpha)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
+librt_CSRC := mq_notify.c
endif
ifeq ($(TARGET_ARCH),mips)
@@ -34,15 +47,29 @@ endif
ifeq ($(TARGET_ARCH),powerpc)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
+librt_CSRC := mq_notify.c
endif
ifeq ($(TARGET_ARCH),sparc)
libpthread_CSRC += lowlevellock.c
libc_CSRC += libc-lowlevellock.c
+librt_CSRC := mq_notify.c
+endif
+
+ifeq ($(TARGET_ARCH),x86_64)
+librt_CSRC := mq_notify.c
endif
-CFLAGS-pt-fork.c = -D_GNU_SOURCE
-CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)/librt
+CFLAGS-pthread_getcpuclockid.c = -I$(top_srcdir)librt
+CFLAGS-pt-pread_pwrite.c = -I$(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH) \
+ -I$(top_srcdir)libc/sysdeps/linux/common
+CFLAGS-mq_notify.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_create.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_delete.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_getoverr.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_gettime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_routines.c = -I$(top_srcdir)librt -DIS_IN_librt=1
+CFLAGS-timer_settime.c = -I$(top_srcdir)librt -DIS_IN_librt=1
CFLAGS-linux = -DNOT_IN_libc=1 -DIS_IN_libpthread=1 $(SSP_ALL_CFLAGS)
#CFLAGS:=$(CFLAGS:-O1=-O2)
@@ -55,6 +82,31 @@ CFLAGS-OMIT-getpid.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-raise.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-sleep.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
CFLAGS-OMIT-libc-lowlevellock.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-exit-thread.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-close.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-open.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-read.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-write.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-nanosleep.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-creat.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-pause.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-accept.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-connect.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-recv.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-recvfrom.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-recvmsg.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-send.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-sendmsg.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-sendto.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-lseek.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-msync.S = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
+CFLAGS-OMIT-mq_notify.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_create.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_delete.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_getoverr.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_gettime.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_routines.c = -DIS_IN_libpthread=1
+CFLAGS-OMIT-timer_settime.c = -DIS_IN_libpthread=1
PTHREAD_LINUX_DIR := $(top_srcdir)/libpthread/nptl/sysdeps/unix/sysv/linux
PTHREAD_LINUX_OUT := $(top_builddir)/libpthread/nptl/sysdeps/unix/sysv/linux
@@ -64,17 +116,20 @@ PTHREAD_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libpthread_SSRC))
libpthread-a-y += $(PTHREAD_LINUX_OBJ)
libpthread-so-y += $(PTHREAD_LINUX_OBJ:.o=.oS)
-
libpthread-nomulti-y += $(PTHREAD_LINUX_OBJ)
LIBC_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(libc_CSRC))
LIBC_LINUX_OBJ += $(patsubst %.S,$(PTHREAD_LINUX_OUT)/%.o,$(libc_SSRC))
-libc-a-y += $(LIBC_LINUX_OBJ)
-libc-so-y += $(LIBC_LINUX_OBJ:.o=.oS)
-
+libc-static-y += $(LIBC_LINUX_OBJ)
+libc-shared-y += $(LIBC_LINUX_OBJ:.o=.oS)
libc-nomulti-y += $(LIBC_LINUX_OBJ)
+LIBRT_LINUX_OBJ := $(patsubst %.c,$(PTHREAD_LINUX_OUT)/%.o,$(librt_CSRC))
+
+librt-a-y += $(LIBRT_LINUX_OBJ)
+librt-so-y += $(LIBRT_LINUX_OBJ:.o=.oS)
+
objclean-y += nptl_linux_objclean
headers_clean-y += nptl_linux_headers_clean
@@ -122,10 +177,6 @@ $(PTHREAD_LINUX_OUT)/lowlevelrwlock.h: $(PTHREAD_LINUX_OUT)/lowlevelrwlock.s
$(PTHREAD_LINUX_OUT)/unwindbuf.h: $(PTHREAD_LINUX_OUT)/unwindbuf.s
@sed -n "s/^.*@@@name@@@\([^@]*\)@@@value@@@[^0-9Xxa-fA-F-]*\([0-9Xxa-fA-F-][0-9Xxa-fA-F-]*\).*@@@end@@@.*$\/#define \1 \2/p" $< > $@
-ptw-%.oS:
- $(PTHREAD_LINUX_OUT)/sjh.sh $* > $(PTHREAD_LINUX_OUT)/tmp.S
- $(compile.S) -x assembler-with-cpp tmp.S
-
nptl_linux_headers:
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelbarrier.h
$(MAKE) $(PTHREAD_LINUX_OUT)/lowlevelcond.h
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
index 7586de8a4..5d894225a 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/fork.c
@@ -19,6 +19,7 @@
#include <assert.h>
#include <stdlib.h>
+#include <syscall.h>
#include <unistd.h>
#include <sys/types.h>
#include <sysdep.h>
@@ -26,7 +27,6 @@
#include "fork.h"
#include <hp-timing.h>
#include <ldsodefs.h>
-#include <bits/stdio-lock.h>
#include <atomic.h>
#include <errno.h>
@@ -59,9 +59,8 @@ fresetlockfiles (void)
#endif
}
-
-pid_t
-__libc_fork (void)
+extern __typeof(fork) __libc_fork;
+pid_t __libc_fork (void)
{
pid_t pid;
struct used_handler
@@ -228,6 +227,6 @@ __libc_fork (void)
return pid;
}
-weak_alias (__libc_fork, __fork)
-hidden_def (__fork)
-weak_alias (__libc_fork, fork)
+libc_hidden_proto(fork)
+weak_alias(__libc_fork,fork)
+libc_hidden_weak(fork)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
index e39f63229..9a4f51c9d 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/getpid.c
@@ -22,11 +22,11 @@
#include <sysdep.h>
+extern __typeof(getpid) __getpid;
#ifndef NOT_IN_libc
-static inline __attribute__((always_inline)) pid_t really_getpid (pid_t oldval);
+static __always_inline pid_t really_getpid (pid_t oldval);
-static inline __attribute__((always_inline)) pid_t
-really_getpid (pid_t oldval)
+static __always_inline pid_t really_getpid (pid_t oldval)
{
if (__builtin_expect (oldval == 0, 1))
{
@@ -46,8 +46,7 @@ really_getpid (pid_t oldval)
}
#endif
-pid_t attribute_hidden
-__getpid (void)
+pid_t __getpid (void)
{
#ifdef NOT_IN_libc
INTERNAL_SYSCALL_DECL (err);
@@ -59,5 +58,6 @@ __getpid (void)
#endif
return result;
}
-
-weak_alias (__getpid, getpid)
+libc_hidden_proto(getpid)
+weak_alias(__getpid, getpid)
+libc_hidden_weak(getpid)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c
index 0ddfe70da..b874538b3 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/i386/fork.c
@@ -23,7 +23,6 @@
#include <sysdep.h>
#include <tls.h>
-
#define ARCH_FORK() \
INLINE_SYSCALL (clone, 5, \
CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD, 0, \
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
index f337816cf..5d3bcb0d6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/libc_pthread_init.c
@@ -25,6 +25,7 @@
#include <pthreadP.h>
#include <bits/libc-lock.h>
+libc_hidden_proto(memcpy)
#ifdef TLS_MULTIPLE_THREADS_IN_TCB
void
@@ -48,7 +49,7 @@ __libc_pthread_init (ptr, reclaim, functions)
/* We copy the content of the variable pointed to by the FUNCTIONS
parameter to one in libc.so since this means access to the array
can be done with one memory access instead of two. */
- __memcpy (&__libc_pthread_functions, functions,
+ memcpy (&__libc_pthread_functions, functions,
sizeof (__libc_pthread_functions));
#endif
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
index 6c77bb5d5..8011cc087 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/mips/Makefile.arch
@@ -10,6 +10,7 @@ libpthread_CSRC = pthread_once.c
libc_a_CSRC = fork.c
+CFLAGS-OMIT-fork.c = -DNOT_IN_libc=1 -DIS_IN_libpthread=1
ifeq ($(UCLIBC_HAS_STDIO_FUTEXES),y)
CFLAGS-fork.c = -D__USE_STDIO_FUTEXES__
endif
@@ -33,8 +34,8 @@ libpthread-nomulti-y+=$(LINUX_ARCH_OBJS)
LIBC_LINUX_ARCH_OBJ:=$(patsubst %.c,$(LINUX_ARCH_OUT)/%.o,$(libc_a_CSRC))
-libc-a-y+=$(LIBC_LINUX_ARCH_OBJ)
-libc-so-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
+libc-static-y+=$(LIBC_LINUX_ARCH_OBJ)
+libc-shared-y+=$(LIBC_LINUX_ARCH_OBJ:.o=.oS)
libc-nomulti-y+=$(LIBC_LINUX_ARCH_OBJ)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
index a1e228ee2..3e1b70f86 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-fork.c
@@ -19,6 +19,7 @@
#include <unistd.h>
+extern int __libc_fork (void);
pid_t
__fork (void)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c
index 9161e29e2..fa4f75471 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pt-raise.c
@@ -23,10 +23,8 @@
#include <tls.h>
#include <kernel-features.h>
-
-int
-raise (sig)
- int sig;
+extern __typeof(raise) __raise;
+int __raise (int sig)
{
#if __ASSUME_TGKILL || defined __NR_tgkill
/* raise is an async-safe function. It could be called while the
@@ -50,3 +48,6 @@ raise (sig)
return INLINE_SYSCALL (tkill, 2, THREAD_GETMEM (THREAD_SELF, tid), sig);
#endif
}
+libc_hidden_proto(raise)
+weak_alias(__raise, raise)
+libc_hidden_weak(raise)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c
index ead5d42bb..3ca9d7d94 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/pthread_getaffinity.c
@@ -42,5 +42,5 @@ __pthread_getaffinity_new (pthread_t th, size_t cpusetsize, cpu_set_t *cpuset)
return 0;
}
-hidden_strong_alias (__pthread_getaffinity_new, __pthread_getaffinity_np)
-strong_alias (__pthread_getaffinity_new, pthread_getaffinity_np)
+strong_alias(__pthread_getaffinity_new, __pthread_getaffinity_np)
+strong_alias(__pthread_getaffinity_new, pthread_getaffinity_np)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
index 07cb35ae1..7c7c32c4e 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/raise.c
@@ -25,9 +25,8 @@
#include <kernel-features.h>
-int attribute_hidden
-__raise (sig)
- int sig;
+extern __typeof(raise) __raise;
+int __raise (int sig)
{
struct pthread *pd = THREAD_SELF;
#if __ASSUME_TGKILL || defined __NR_tgkill
@@ -71,4 +70,6 @@ __raise (sig)
return INLINE_SYSCALL (tkill, 2, selftid, sig);
#endif
}
+libc_hidden_proto(raise)
weak_alias(__raise, raise)
+libc_hidden_weak(raise)
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c
index c6ea739d3..6c47fdee6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sigwaitinfo.c
@@ -69,9 +69,7 @@ do_sigwaitinfo (const sigset_t *set, siginfo_t *info)
/* Return any pending signal or wait for one for the given time. */
int
-__sigwaitinfo (set, info)
- const sigset_t *set;
- siginfo_t *info;
+__sigwaitinfo (const sigset_t *set, siginfo_t *info)
{
if (SINGLE_THREAD_P)
return do_sigwaitinfo (set, info);
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c b/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c
index 579b00be3..9e948adce 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/sleep.c
@@ -1,150 +1,2 @@
-/* Implementation of the POSIX sleep function using nanosleep.
- Copyright (C) 1996,1997,1998,1999,2003,2005 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
-
- 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 <pthreadP.h>
-#include <errno.h>
-#include <time.h>
-#include <signal.h>
-#include <string.h> /* For the real memset prototype. */
-#include <unistd.h>
-#include <sys/param.h>
-
-
-#if 0
-static void
-cl (void *arg)
-{
- (void) __sigprocmask (SIG_SETMASK, arg, (sigset_t *) NULL);
-}
-#endif
-
-
-/* We are going to use the `nanosleep' syscall of the kernel. But the
- kernel does not implement the stupid SysV SIGCHLD vs. SIG_IGN
- behaviour for this syscall. Therefore we have to emulate it here. */
-unsigned int
-__sleep (unsigned int seconds)
-{
- const unsigned int max
- = (unsigned int) (((unsigned long int) (~((time_t) 0))) >> 1);
- struct timespec ts;
- sigset_t set, oset;
- unsigned int result;
-
- /* This is not necessary but some buggy programs depend on this. */
- if (__builtin_expect (seconds == 0, 0))
- {
-#ifdef CANCELLATION_P
- CANCELLATION_P (THREAD_SELF);
-#endif
- return 0;
- }
-
- ts.tv_sec = 0;
- ts.tv_nsec = 0;
- again:
- if (sizeof (ts.tv_sec) <= sizeof (seconds))
- {
- /* Since SECONDS is unsigned assigning the value to .tv_sec can
- overflow it. In this case we have to wait in steps. */
- ts.tv_sec += MIN (seconds, max);
- seconds -= (unsigned int) ts.tv_sec;
- }
- else
- {
- ts.tv_sec = (time_t) seconds;
- seconds = 0;
- }
-
- /* Linux will wake up the system call, nanosleep, when SIGCHLD
- arrives even if SIGCHLD is ignored. We have to deal with it
- in libc. We block SIGCHLD first. */
- __sigemptyset (&set);
- __sigaddset (&set, SIGCHLD);
- if (__sigprocmask (SIG_BLOCK, &set, &oset))
- return -1;
-
- /* If SIGCHLD is already blocked, we don't have to do anything. */
- if (!__sigismember (&oset, SIGCHLD))
- {
- int saved_errno;
- struct sigaction oact;
-
- __sigemptyset (&set);
- __sigaddset (&set, SIGCHLD);
-
- /* We get the signal handler for SIGCHLD. */
- if (sigaction (SIGCHLD, (struct sigaction *) NULL, &oact) < 0)
- {
- saved_errno = errno;
- /* Restore the original signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
- __set_errno (saved_errno);
- return -1;
- }
-
- /* Note the sleep() is a cancellation point. But since we call
- nanosleep() which itself is a cancellation point we do not
- have to do anything here. */
- if (oact.sa_handler == SIG_IGN)
- {
- //__libc_cleanup_push (cl, &oset);
-
- /* We should leave SIGCHLD blocked. */
- while (1)
- {
- result = nanosleep (&ts, &ts);
-
- if (result != 0 || seconds == 0)
- break;
-
- if (sizeof (ts.tv_sec) <= sizeof (seconds))
- {
- ts.tv_sec = MIN (seconds, max);
- seconds -= (unsigned int) ts.tv_nsec;
- }
- }
-
- //__libc_cleanup_pop (0);
-
- saved_errno = errno;
- /* Restore the original signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
- __set_errno (saved_errno);
-
- goto out;
- }
-
- /* We should unblock SIGCHLD. Restore the original signal mask. */
- (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
- }
-
- result = nanosleep (&ts, &ts);
- if (result == 0 && seconds != 0)
- goto again;
-
- out:
- if (result != 0)
- /* Round remaining time. */
- result = seconds + (unsigned int) ts.tv_sec + (ts.tv_nsec >= 500000000L);
-
- return result;
-}
-weak_alias (__sleep, sleep)
+#include <../../../../../../libc/unistd/sleep.c>
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
index 5e9951395..8ca24c7f9 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_create.c
@@ -26,7 +26,7 @@
#include <sysdep.h>
#include <kernel-features.h>
#include <internaltypes.h>
-#include <nptl/pthreadP.h>
+#include <pthreadP.h>
#include "kernel-posix-timers.h"
#include "kernel-posix-cpu-timers.h"
diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
index e5214e605..e2b8ddae6 100644
--- a/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
+++ b/libpthread/nptl/sysdeps/unix/sysv/linux/timer_routines.c
@@ -23,7 +23,7 @@
#include <stdbool.h>
#include <sysdep.h>
#include <kernel-features.h>
-#include <nptl/pthreadP.h>
+#include <pthreadP.h>
#include "kernel-posix-timers.h"
diff --git a/libpthread/nptl/unwind.c b/libpthread/nptl/unwind.c
index cf8d9e506..56a423815 100644
--- a/libpthread/nptl/unwind.c
+++ b/libpthread/nptl/unwind.c
@@ -162,6 +162,7 @@ __pthread_unwind (__pthread_unwind_buf_t *buf)
/* We better do not get here. */
abort ();
}
+hidden_def (__pthread_unwind)
void
@@ -172,3 +173,4 @@ __pthread_unwind_next (__pthread_unwind_buf_t *buf)
__pthread_unwind ((__pthread_unwind_buf_t *) ibuf->priv.data.prev);
}
+hidden_def (__pthread_unwind_next)