diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-24 02:55:31 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-26 20:23:24 +0200 |
commit | 29ff9055c80efe77a7130767a9fcb3ab8c67e8ce (patch) | |
tree | b061656c1336d7d73ed5eef59352e3d50d8147a7 /libpthread/linuxthreads | |
parent | b06f85d62c41a4ed108628b1c564203f36c0ab4e (diff) |
use a single libc and deduplicate threading code
Similar to musl libc a single libc has many benefits and solves
some open issues with uClibc-ng.
- no pthread_mutex_* weak symbols exported anymore
- applications no longer failing to link when either
-lrt or -lpthread are missing for dynamic and static linking mode
- smaller C library
- slightly better runtime performance
Diffstat (limited to 'libpthread/linuxthreads')
-rw-r--r-- | libpthread/linuxthreads/Makefile.in | 43 | ||||
-rw-r--r-- | libpthread/linuxthreads/forward.c | 173 | ||||
-rw-r--r-- | libpthread/linuxthreads/internals.h | 3 | ||||
-rw-r--r-- | libpthread/linuxthreads/libc_pthread_init.c | 11 | ||||
-rw-r--r-- | libpthread/linuxthreads/manager.c | 3 | ||||
-rw-r--r-- | libpthread/linuxthreads/pthread.c | 98 | ||||
-rw-r--r-- | libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h | 66 | ||||
-rw-r--r-- | libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h | 113 |
8 files changed, 6 insertions, 504 deletions
diff --git a/libpthread/linuxthreads/Makefile.in b/libpthread/linuxthreads/Makefile.in index 47c45eff1..ffdd5d4eb 100644 --- a/libpthread/linuxthreads/Makefile.in +++ b/libpthread/linuxthreads/Makefile.in @@ -11,20 +11,6 @@ subdirs += libpthread/linuxthreads CFLAGS-dir_linuxthreads := -DNOT_IN_libc -DIS_IN_libpthread CFLAGS-libpthread/linuxthreads := $(CFLAGS-dir_linuxthreads) $(SSP_ALL_CFLAGS) -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -Wl,-z,defs -else -LDFLAGS-libpthread.so := $(LDFLAGS) -endif -LDFLAGS-$(UCLIBC_FORMAT_DSBT_ELF)-libpthread.so := -Wl,--dsbt-index=10 - -LIBS-libpthread.so := $(LIBS) $(ldso) - -START_FILE-libpthread.so := $(SHARED_START_FILES) -END_FILE-libpthread.so := $(SHARED_END_FILES) - -libpthread_FULL_NAME := libpthread-$(VERSION).so - libpthread_DIR := $(top_srcdir)libpthread/linuxthreads libpthread_OUT := $(top_builddir)libpthread/linuxthreads @@ -50,9 +36,8 @@ libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpt # # Stuff that goes into libc.so, not libpthread.so # -CFLAGS-OMIT-forward.c := $(CFLAGS-dir_linuxthreads) CFLAGS-OMIT-libc_pthread_init.c := $(CFLAGS-dir_linuxthreads) -libpthread_libc_CSRC := forward.c libc_pthread_init.c +libpthread_libc_CSRC := libc_pthread_init.c libpthread_libc_OBJ := $(patsubst %.c, $(libpthread_OUT)/%.o,$(libpthread_libc_CSRC)) libc-static-y += $(libpthread_OUT)/libc_pthread_init.o libc-shared-y += $(libpthread_libc_OBJ:.o=.oS) @@ -64,24 +49,6 @@ libpthread-a-y += $(libpthread_OBJ) endif 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 - -$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a $(libc.depend) $(top_builddir)lib/libpthread_nonshared.a - $(call link.so,$(libpthread_FULL_NAME),$(ABI_VERSION)) - # link for backward compatibility - $(call link.so,$(libpthread_FULL_NAME),0) - $(Q)cat $(top_srcdir)extra/scripts/format.lds > $@.tmp - $(Q)echo "GROUP ( $(notdir $@).$(ABI_VERSION) libpthread_nonshared.a )" >> $@.tmp - $(Q)mv $@.tmp $@ - -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -$(libpthread_OUT)/libpthread_so.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) -endif -$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y) - $(Q)$(RM) $@ - $(do_ar) - ifeq ($(PTHREADS_DEBUG_SUPPORT),y) $(libpthread_OUT)/libpthread.oS: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) endif @@ -89,14 +56,6 @@ $(libpthread_OUT)/libpthread.oS: $(libpthread_SRC) $(Q)$(RM) $@ $(compile-m) -ifeq ($(PTHREADS_DEBUG_SUPPORT),y) -$(top_builddir)lib/libpthread.a: STRIP_FLAGS:=$(STRIP_FLAGS:-x=-X --strip-debug) -endif -$(top_builddir)lib/libpthread.a: $(libpthread-a-y) - $(Q)$(INSTALL) -d $(dir $@) - $(Q)$(RM) $@ - $(do_ar) - $(top_builddir)include/pthread.h: $(do_ln) $(call rel_srcdir)$(PTDIR)/sysdeps/pthread/$(@F) $@ $(top_builddir)include/semaphore.h: diff --git a/libpthread/linuxthreads/forward.c b/libpthread/linuxthreads/forward.c deleted file mode 100644 index 08295c8db..000000000 --- a/libpthread/linuxthreads/forward.c +++ /dev/null @@ -1,173 +0,0 @@ -/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. - - 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, see - <http://www.gnu.org/licenses/>. */ - -#include <features.h> -#include <stdlib.h> -#include <dlfcn.h> - -/* psm: keep this before internals.h */ -#if 0 -vda: here is why: -headers contain libc_hidden_proto(foo). -In libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h -adding libc_hidden_proto(foo) just before weak_extern (__pthread_initialize) -will not warn: - /* libc_hidden_proto(foo) */ - weak_extern (__pthread_initialize) - /* 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/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> -#include <signal.h> -#include <unistd.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/time.h> - -#include "internals.h" - -/* Pointers to the libc functions. */ -struct pthread_functions __libc_pthread_functions attribute_hidden; - - -# define FORWARD2(name, rettype, decl, params, defaction) \ -rettype \ -name decl \ -{ \ - if (__libc_pthread_functions.ptr_##name == NULL) \ - defaction; \ - \ - return __libc_pthread_functions.ptr_##name params; \ -} - -# define FORWARD(name, decl, params, defretval) \ - FORWARD2 (name, int, decl, params, return defretval) - -FORWARD (pthread_attr_destroy, (pthread_attr_t *attr), (attr), 0) - -FORWARD (pthread_attr_init, (pthread_attr_t *attr), (attr), 0) - -FORWARD (pthread_attr_getdetachstate, - (const pthread_attr_t *attr, int *detachstate), (attr, detachstate), - 0) -FORWARD (pthread_attr_setdetachstate, (pthread_attr_t *attr, int detachstate), - (attr, detachstate), 0) - -FORWARD (pthread_attr_getinheritsched, - (const pthread_attr_t *attr, int *inherit), (attr, inherit), 0) -FORWARD (pthread_attr_setinheritsched, (pthread_attr_t *attr, int inherit), - (attr, inherit), 0) - -FORWARD (pthread_attr_getschedparam, - (const pthread_attr_t *attr, struct sched_param *param), - (attr, param), 0) -FORWARD (pthread_attr_setschedparam, - (pthread_attr_t *attr, const struct sched_param *param), - (attr, param), 0) - -FORWARD (pthread_attr_getschedpolicy, - (const pthread_attr_t *attr, int *policy), (attr, policy), 0) -FORWARD (pthread_attr_setschedpolicy, (pthread_attr_t *attr, int policy), - (attr, policy), 0) - -FORWARD (pthread_attr_getscope, - (const pthread_attr_t *attr, int *scope), (attr, scope), 0) -FORWARD (pthread_attr_setscope, (pthread_attr_t *attr, int scope), - (attr, scope), 0) - - -FORWARD (pthread_condattr_destroy, (pthread_condattr_t *attr), (attr), 0) -FORWARD (pthread_condattr_init, (pthread_condattr_t *attr), (attr), 0) - - -FORWARD (pthread_cond_broadcast, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_destroy, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_init, - (pthread_cond_t *cond, const pthread_condattr_t *cond_attr), - (cond, cond_attr), 0) - -FORWARD (pthread_cond_signal, (pthread_cond_t *cond), (cond), 0) - -FORWARD (pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t *mutex), - (cond, mutex), 0) - -FORWARD (pthread_cond_timedwait, - (pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime), (cond, mutex, abstime), 0) - - -FORWARD (pthread_equal, (pthread_t thread1, pthread_t thread2), - (thread1, thread2), 1) - - -/* Use an alias to avoid warning, as pthread_exit is declared noreturn. */ -FORWARD2 (__pthread_exit, void, (void *retval), (retval), exit (EXIT_SUCCESS)) -strong_alias (__pthread_exit, pthread_exit) - - -FORWARD (pthread_getschedparam, - (pthread_t target_thread, int *policy, struct sched_param *param), - (target_thread, policy, param), 0) -FORWARD (pthread_setschedparam, - (pthread_t target_thread, int policy, - const struct sched_param *param), (target_thread, policy, param), 0) - - -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) -strong_alias(pthread_mutex_init, __pthread_mutex_init) - -FORWARD (pthread_mutex_lock, (pthread_mutex_t *mutex), (mutex), 0) -strong_alias(pthread_mutex_lock, __pthread_mutex_lock) - -FORWARD (pthread_mutex_trylock, (pthread_mutex_t *mutex), (mutex), 0) -strong_alias(pthread_mutex_trylock, __pthread_mutex_trylock) - -FORWARD (pthread_mutex_unlock, (pthread_mutex_t *mutex), (mutex), 0) -strong_alias(pthread_mutex_unlock, __pthread_mutex_unlock) - -FORWARD2 (pthread_self, pthread_t, (void), (), return 0) - - -FORWARD (pthread_setcancelstate, (int state, int *oldstate), (state, oldstate), - 0) - -FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0) - -#if 0 -FORWARD2 (_pthread_cleanup_push, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) -#endif -FORWARD2 (_pthread_cleanup_push_defer, void, (struct _pthread_cleanup_buffer * buffer, void (*routine)(void *), void * arg), (buffer, routine, arg), return) - -#if 0 -FORWARD2 (_pthread_cleanup_pop, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) -#endif -FORWARD2 (_pthread_cleanup_pop_restore, void, (struct _pthread_cleanup_buffer * buffer, int execute), (buffer, execute), return) diff --git a/libpthread/linuxthreads/internals.h b/libpthread/linuxthreads/internals.h index 1b310b564..ab6b01528 100644 --- a/libpthread/linuxthreads/internals.h +++ b/libpthread/linuxthreads/internals.h @@ -446,7 +446,6 @@ static __inline__ pthread_descr thread_self (void) /* Defined and used in libc.so. */ extern int __libc_multiple_threads attribute_hidden; -extern int __librt_multiple_threads; /* Internal global functions */ @@ -524,6 +523,6 @@ extern void __linuxthreads_create_event (void) attribute_hidden; extern void __linuxthreads_death_event (void) attribute_hidden; extern void __linuxthreads_reap_event (void) attribute_hidden; -#include <pthread-functions.h> +extern int * __libc_pthread_init (void); #endif /* internals.h */ diff --git a/libpthread/linuxthreads/libc_pthread_init.c b/libpthread/linuxthreads/libc_pthread_init.c index b64da05d1..26f1abcb6 100644 --- a/libpthread/linuxthreads/libc_pthread_init.c +++ b/libpthread/linuxthreads/libc_pthread_init.c @@ -18,20 +18,11 @@ #include <locale.h> #include <string.h> -#include <linuxthreads/sysdeps/pthread/pthread-functions.h> - int __libc_multiple_threads attribute_hidden __attribute__((nocommon)); -int * __libc_pthread_init (const struct pthread_functions *functions) +int * __libc_pthread_init (void) { -#ifdef SHARED - /* 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, - sizeof (__libc_pthread_functions)); -#endif #if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_XLOCALE__ /* Initialize thread-locale current locale to point to the global one. diff --git a/libpthread/linuxthreads/manager.c b/libpthread/linuxthreads/manager.c index e4022f8ea..2a1ee62af 100644 --- a/libpthread/linuxthreads/manager.c +++ b/libpthread/linuxthreads/manager.c @@ -47,9 +47,6 @@ # define USE_SELECT #endif -libpthread_hidden_proto(waitpid) -libpthread_hidden_proto(raise) - /* Array of active threads. Entry 0 is reserved for the initial thread. */ struct pthread_handle_struct __pthread_handles[PTHREAD_THREADS_MAX] = { { __LOCK_INITIALIZER, &__pthread_initial_thread, 0}, diff --git a/libpthread/linuxthreads/pthread.c b/libpthread/linuxthreads/pthread.c index 00197b158..d02da6b6c 100644 --- a/libpthread/linuxthreads/pthread.c +++ b/libpthread/linuxthreads/pthread.c @@ -36,9 +36,6 @@ #include <sys/types.h> #include <sys/syscall.h> -libpthread_hidden_proto(waitpid) -libpthread_hidden_proto(raise) - /* These variables are used by the setup code. */ extern int _errno; extern int _h_errno; @@ -216,16 +213,12 @@ int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abstim values to some unreasonable value which will signal failing of all the functions below. */ #ifndef __NR_rt_sigaction -static int current_rtmin = -1; -static int current_rtmax = -1; int __pthread_sig_restart = SIGUSR1; int __pthread_sig_cancel = SIGUSR2; int __pthread_sig_debug; #else #if __SIGRTMAX - __SIGRTMIN >= 3 -static int current_rtmin = __SIGRTMIN + 3; -static int current_rtmax = __SIGRTMAX; int __pthread_sig_restart = __SIGRTMIN; int __pthread_sig_cancel = __SIGRTMIN + 1; int __pthread_sig_debug = __SIGRTMIN + 2; @@ -233,8 +226,6 @@ void (*__pthread_restart)(pthread_descr) = __pthread_restart_new; void (*__pthread_suspend)(pthread_descr) = __pthread_wait_for_restart_signal; int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_new; #else -static int current_rtmin = __SIGRTMIN; -static int current_rtmax = __SIGRTMAX; int __pthread_sig_restart = SIGUSR1; int __pthread_sig_cancel = SIGUSR2; int __pthread_sig_debug; @@ -243,32 +234,6 @@ void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old; int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *) = __pthread_timedsuspend_old; #endif - -/* Return number of available real-time signal with highest priority. */ -int __libc_current_sigrtmin (void) -{ - return current_rtmin; -} - -/* Return number of available real-time signal with lowest priority. */ -int __libc_current_sigrtmax (void) -{ - return current_rtmax; -} - -#if 0 -/* Allocate real-time signal with highest/lowest available - priority. Please note that we don't use a lock since we assume - this function to be called at program start. */ -int __libc_allocate_rtsig (int high); -int __libc_allocate_rtsig (int high) -{ - if (current_rtmin == -1 || current_rtmin > current_rtmax) - /* We don't have anymore signal available. */ - return -1; - return high ? current_rtmin++ : current_rtmax--; -} -#endif #endif /* Initialize the pthread library. @@ -315,67 +280,6 @@ libpthread_hidden_proto(pthread_cond_timedwait) libpthread_hidden_proto(pthread_condattr_destroy) libpthread_hidden_proto(pthread_condattr_init) -struct pthread_functions __pthread_functions = - { -#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ - .ptr_pthread_internal_tsd_set = __pthread_internal_tsd_set, - .ptr_pthread_internal_tsd_get = __pthread_internal_tsd_get, - .ptr_pthread_internal_tsd_address = __pthread_internal_tsd_address, -#endif -/* - .ptr_pthread_fork = __pthread_fork, -*/ - .ptr_pthread_attr_destroy = pthread_attr_destroy, - .ptr_pthread_attr_init = pthread_attr_init, - .ptr_pthread_attr_getdetachstate = pthread_attr_getdetachstate, - .ptr_pthread_attr_setdetachstate = pthread_attr_setdetachstate, - .ptr_pthread_attr_getinheritsched = pthread_attr_getinheritsched, - .ptr_pthread_attr_setinheritsched = pthread_attr_setinheritsched, - .ptr_pthread_attr_getschedparam = pthread_attr_getschedparam, - .ptr_pthread_attr_setschedparam = pthread_attr_setschedparam, - .ptr_pthread_attr_getschedpolicy = pthread_attr_getschedpolicy, - .ptr_pthread_attr_setschedpolicy = pthread_attr_setschedpolicy, - .ptr_pthread_attr_getscope = pthread_attr_getscope, - .ptr_pthread_attr_setscope = pthread_attr_setscope, - .ptr_pthread_condattr_destroy = pthread_condattr_destroy, - .ptr_pthread_condattr_init = pthread_condattr_init, - .ptr_pthread_cond_broadcast = pthread_cond_broadcast, - .ptr_pthread_cond_destroy = pthread_cond_destroy, - .ptr_pthread_cond_init = pthread_cond_init, - .ptr_pthread_cond_signal = pthread_cond_signal, - .ptr_pthread_cond_wait = pthread_cond_wait, - .ptr_pthread_cond_timedwait = pthread_cond_timedwait, - .ptr_pthread_equal = pthread_equal, - .ptr___pthread_exit = pthread_exit, - .ptr_pthread_getschedparam = pthread_getschedparam, - .ptr_pthread_setschedparam = pthread_setschedparam, - .ptr_pthread_mutex_destroy = __pthread_mutex_destroy, - .ptr_pthread_mutex_init = __pthread_mutex_init, - .ptr_pthread_mutex_lock = __pthread_mutex_lock, - .ptr_pthread_mutex_trylock = __pthread_mutex_trylock, - .ptr_pthread_mutex_unlock = __pthread_mutex_unlock, - .ptr_pthread_self = pthread_self, - .ptr_pthread_setcancelstate = pthread_setcancelstate, - .ptr_pthread_setcanceltype = pthread_setcanceltype, -/* - .ptr_pthread_do_exit = pthread_do_exit, - .ptr_pthread_thread_self = pthread_thread_self, - .ptr_pthread_cleanup_upto = pthread_cleanup_upto, - .ptr_pthread_sigaction = pthread_sigaction, - .ptr_pthread_sigwait = pthread_sigwait, - .ptr_pthread_raise = pthread_raise, - .ptr__pthread_cleanup_push = _pthread_cleanup_push, - .ptr__pthread_cleanup_pop = _pthread_cleanup_pop, -*/ - .ptr__pthread_cleanup_push_defer = __pthread_cleanup_push_defer, - .ptr__pthread_cleanup_pop_restore = __pthread_cleanup_pop_restore - }; -#ifdef SHARED -# define ptr_pthread_functions &__pthread_functions -#else -# define ptr_pthread_functions NULL -#endif - static int *__libc_multiple_threads_ptr; /* Do some minimal initialization which has to be done during the @@ -388,7 +292,7 @@ void __pthread_initialize_minimal(void) INIT_THREAD_SELF(&__pthread_initial_thread, 0); #endif - __libc_multiple_threads_ptr = __libc_pthread_init (ptr_pthread_functions); + __libc_multiple_threads_ptr = __libc_pthread_init (); } diff --git a/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h index a7c0249cf..c00d60bf0 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -105,13 +105,8 @@ typedef pthread_key_t __libc_key_t; (FUNC != NULL ? FUNC ARGS : ELSE) # endif #endif -#if defined _LIBC && !defined NOT_IN_libc && defined SHARED -# define __libc_maybe_call2(FUNC, ARGS, ELSE) \ - ({__builtin_expect (__libc_pthread_functions.ptr_##FUNC != NULL, 0) \ - ? __libc_pthread_functions.ptr_##FUNC ARGS : ELSE; }) -#else -# define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) -#endif + +#define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ @@ -351,63 +346,6 @@ extern int __pthread_atfork (void (*__prepare) (void), void (*__child) (void)); - -/* Make the pthread functions weak so that we can elide them from - single-threaded processes. */ -#ifndef __NO_WEAK_PTHREAD_ALIASES -# ifdef weak_extern -# define BP_SYM(sym) sym -weak_extern (BP_SYM (__pthread_mutex_init)) -weak_extern (BP_SYM (__pthread_mutex_destroy)) -weak_extern (BP_SYM (__pthread_mutex_lock)) -weak_extern (BP_SYM (__pthread_mutex_trylock)) -weak_extern (BP_SYM (__pthread_mutex_unlock)) -weak_extern (BP_SYM (__pthread_mutexattr_init)) -weak_extern (BP_SYM (__pthread_mutexattr_destroy)) -weak_extern (BP_SYM (__pthread_mutexattr_settype)) -weak_extern (BP_SYM (__pthread_rwlock_init)) -weak_extern (BP_SYM (__pthread_rwlock_destroy)) -weak_extern (BP_SYM (__pthread_rwlock_rdlock)) -weak_extern (BP_SYM (__pthread_rwlock_tryrdlock)) -weak_extern (BP_SYM (__pthread_rwlock_wrlock)) -weak_extern (BP_SYM (__pthread_rwlock_trywrlock)) -weak_extern (BP_SYM (__pthread_rwlock_unlock)) -weak_extern (BP_SYM (__pthread_key_create)) -weak_extern (BP_SYM (__pthread_setspecific)) -weak_extern (BP_SYM (__pthread_getspecific)) -weak_extern (BP_SYM (__pthread_once)) -weak_extern (__pthread_atfork) -weak_extern (BP_SYM (_pthread_cleanup_push)) -weak_extern (BP_SYM (_pthread_cleanup_pop)) -weak_extern (BP_SYM (_pthread_cleanup_push_defer)) -weak_extern (BP_SYM (_pthread_cleanup_pop_restore)) -# else -# pragma weak __pthread_mutex_init -# pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock -# pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock -# pragma weak __pthread_mutexattr_init -# pragma weak __pthread_mutexattr_destroy -# pragma weak __pthread_mutexattr_settype -# pragma weak __pthread_rwlock_destroy -# pragma weak __pthread_rwlock_rdlock -# pragma weak __pthread_rwlock_tryrdlock -# pragma weak __pthread_rwlock_wrlock -# pragma weak __pthread_rwlock_trywrlock -# pragma weak __pthread_rwlock_unlock -# pragma weak __pthread_key_create -# pragma weak __pthread_setspecific -# pragma weak __pthread_getspecific -# pragma weak __pthread_once -# pragma weak __pthread_atfork -# pragma weak _pthread_cleanup_push_defer -# pragma weak _pthread_cleanup_pop_restore -# pragma weak _pthread_cleanup_push -# pragma weak _pthread_cleanup_pop -# endif -#endif - /* We need portable names for some functions. E.g., when they are used as argument to __libc_cleanup_region_start. */ #define __libc_mutex_unlock __pthread_mutex_unlock diff --git a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h b/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h deleted file mode 100644 index 119953df0..000000000 --- a/libpthread/linuxthreads/sysdeps/pthread/pthread-functions.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright (C) 2003 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper <drepper@redhat.com>, 2003. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - <http://www.gnu.org/licenses/>. */ - -#ifndef _PTHREAD_FUNCTIONS_H -#define _PTHREAD_FUNCTIONS_H 1 - -#include <pthread.h> -#if 0 -#include <setjmp.h> -#include <linuxthreads/internals.h> - -struct fork_block; -#endif - -/* Data type shared with libc. The libc uses it to pass on calls to - the thread functions. Wine pokes directly into this structure, - so if possible avoid breaking it and append new hooks to the end. */ -struct pthread_functions -{ -#if 0 - pid_t (*ptr_pthread_fork) (struct fork_block *); -#endif - int (*ptr_pthread_attr_destroy) (pthread_attr_t *); - int (*ptr_pthread_attr_init) (pthread_attr_t *); - int (*ptr_pthread_attr_getdetachstate) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setdetachstate) (pthread_attr_t *, int); - int (*ptr_pthread_attr_getinheritsched) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setinheritsched) (pthread_attr_t *, int); - int (*ptr_pthread_attr_getschedparam) (const pthread_attr_t *, - struct sched_param *); - int (*ptr_pthread_attr_setschedparam) (pthread_attr_t *, - const struct sched_param *); - int (*ptr_pthread_attr_getschedpolicy) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setschedpolicy) (pthread_attr_t *, int); - int (*ptr_pthread_attr_getscope) (const pthread_attr_t *, int *); - int (*ptr_pthread_attr_setscope) (pthread_attr_t *, int); - int (*ptr_pthread_condattr_destroy) (pthread_condattr_t *); - int (*ptr_pthread_condattr_init) (pthread_condattr_t *); - int (*ptr_pthread_cond_broadcast) (pthread_cond_t *); - int (*ptr_pthread_cond_destroy) (pthread_cond_t *); - int (*ptr_pthread_cond_init) (pthread_cond_t *, - const pthread_condattr_t *); - int (*ptr_pthread_cond_signal) (pthread_cond_t *); - int (*ptr_pthread_cond_wait) (pthread_cond_t *, pthread_mutex_t *); - int (*ptr_pthread_equal) (pthread_t, pthread_t); - void (*ptr___pthread_exit) (void *); - int (*ptr_pthread_getschedparam) (pthread_t, int *, struct sched_param *); - int (*ptr_pthread_setschedparam) (pthread_t, int, - const struct sched_param *); - int (*ptr_pthread_mutex_destroy) (pthread_mutex_t *); - int (*ptr_pthread_mutex_init) (pthread_mutex_t *, - const pthread_mutexattr_t *); - int (*ptr_pthread_mutex_lock) (pthread_mutex_t *); - int (*ptr_pthread_mutex_trylock) (pthread_mutex_t *); - int (*ptr_pthread_mutex_unlock) (pthread_mutex_t *); - pthread_t (*ptr_pthread_self) (void); - int (*ptr_pthread_setcancelstate) (int, int *); - int (*ptr_pthread_setcanceltype) (int, int *); -#if 0 - void (*ptr_pthread_do_exit) (void *retval, char *currentframe); - void (*ptr_pthread_cleanup_upto) (__jmp_buf target, - char *targetframe); - pthread_descr (*ptr_pthread_thread_self) (void); -#endif -#if !defined __UCLIBC_HAS_TLS__ && defined __UCLIBC_HAS_RPC__ - int (*ptr_pthread_internal_tsd_set) (int key, const void *pointer); - void * (*ptr_pthread_internal_tsd_get) (int key); - void ** __attribute__ ((__const__)) - (*ptr_pthread_internal_tsd_address) (int key); -#endif -#if 0 - int (*ptr_pthread_sigaction) (int sig, const struct sigaction * act, - struct sigaction *oact); - int (*ptr_pthread_sigwait) (const sigset_t *set, int *sig); - int (*ptr_pthread_raise) (int sig); -#endif - int (*ptr_pthread_cond_timedwait) (pthread_cond_t *, pthread_mutex_t *, - const struct timespec *); -#if 0 - void (*ptr__pthread_cleanup_push) (struct _pthread_cleanup_buffer * buffer, - void (*routine)(void *), void * arg); -#endif - void (*ptr__pthread_cleanup_push_defer) (struct _pthread_cleanup_buffer * buffer, - void (*routine)(void *), void * arg); -#if 0 - void (*ptr__pthread_cleanup_pop) (struct _pthread_cleanup_buffer * buffer, - int execute); -#endif - void (*ptr__pthread_cleanup_pop_restore) (struct _pthread_cleanup_buffer * buffer, - int execute); -}; - -/* Variable in libc.so. */ -extern struct pthread_functions __libc_pthread_functions attribute_hidden; - -extern int * __libc_pthread_init (const struct pthread_functions *functions); - -#endif /* pthread-functions.h */ |