summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpthread/linuxthreads/attr.c367
-rw-r--r--libpthread/linuxthreads/cancel.c23
-rw-r--r--libpthread/linuxthreads/condvar.c103
-rw-r--r--libpthread/linuxthreads/descr.h313
-rw-r--r--libpthread/linuxthreads/events.c10
-rw-r--r--libpthread/linuxthreads/internals.h287
-rw-r--r--libpthread/linuxthreads/join.c4
-rw-r--r--libpthread/linuxthreads/manager.c130
-rw-r--r--libpthread/linuxthreads/mutex.c8
-rw-r--r--libpthread/linuxthreads/oldsemaphore.c12
-rw-r--r--libpthread/linuxthreads/pt-machine.c11
-rw-r--r--libpthread/linuxthreads/pthread.c255
-rw-r--r--libpthread/linuxthreads/rwlock.c239
-rw-r--r--libpthread/linuxthreads/signals.c70
-rw-r--r--libpthread/linuxthreads/specific.c192
-rw-r--r--libpthread/linuxthreads/spinlock.h2
-rw-r--r--libpthread/linuxthreads/sysdeps/i386/useldt.h15
-rw-r--r--libpthread/linuxthreads/wrapsyscall.c220
18 files changed, 792 insertions, 1469 deletions
diff --git a/libpthread/linuxthreads/attr.c b/libpthread/linuxthreads/attr.c
index c84da0d30..4432a04d1 100644
--- a/libpthread/linuxthreads/attr.c
+++ b/libpthread/linuxthreads/attr.c
@@ -12,50 +12,27 @@
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Library General Public License for more details. */
-/* Handling of thread attributes */
-
-/* mods for uClibc */
-#define __getpagesize getpagesize
+/* changed for uClibc */
#define __sched_get_priority_min sched_get_priority_min
#define __sched_get_priority_max sched_get_priority_max
-#define __sched_getscheduler sched_getscheduler
-#define __sched_getparam sched_getparam
-#include <features.h>
-#define __USE_GNU
+/* Handling of thread attributes */
+
#include <errno.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdio_ext.h>
-#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/param.h>
-#include <sys/resource.h>
#include "pthread.h"
#include "internals.h"
-/* glibc uses strong aliases, we wont bother */
-#undef strong_alias
-#define strong_alias(sym, alias)
-#define __pthread_attr_destroy pthread_attr_destroy
-#define __pthread_attr_setdetachstate pthread_attr_setdetachstate
-#define __pthread_attr_getdetachstate pthread_attr_getdetachstate
-#define __pthread_attr_setschedparam pthread_attr_setschedparam
-#define __pthread_attr_getschedparam pthread_attr_getschedparam
-#define __pthread_attr_setschedpolicy pthread_attr_setschedpolicy
-#define __pthread_attr_getschedpolicy pthread_attr_getschedpolicy
-#define __pthread_attr_setinheritsched pthread_attr_setinheritsched
-#define __pthread_attr_getinheritsched pthread_attr_getinheritsched
-#define __pthread_attr_setscope pthread_attr_setscope
-#define __pthread_attr_getscope pthread_attr_getscope
+extern int __getpagesize(void);
/* NOTE: With uClibc I don't think we need this versioning stuff.
* Therefore, define the function pthread_attr_init() here using
* a strong symbol. */
-#define __pthread_attr_init_2_1 pthread_attr_init
-int __pthread_attr_init_2_1(pthread_attr_t *attr)
+//int __pthread_attr_init_2_1(pthread_attr_t *attr)
+int pthread_attr_init(pthread_attr_t *attr)
{
size_t ps = __getpagesize ();
@@ -64,11 +41,7 @@ int __pthread_attr_init_2_1(pthread_attr_t *attr)
attr->__schedparam.sched_priority = 0;
attr->__inheritsched = PTHREAD_EXPLICIT_SCHED;
attr->__scope = PTHREAD_SCOPE_SYSTEM;
-#ifdef NEED_SEPARATE_REGISTER_STACK
- attr->__guardsize = ps + ps;
-#else
attr->__guardsize = ps;
-#endif
attr->__stackaddr = NULL;
attr->__stackaddr_set = 0;
attr->__stacksize = STACK_SIZE - ps;
@@ -76,11 +49,10 @@ int __pthread_attr_init_2_1(pthread_attr_t *attr)
}
/* uClibc: leave out this for now. */
-#if 0
-versioned_symbol (libpthread, __pthread_attr_init_2_1, pthread_attr_init,
- GLIBC_2_1);
+#if DO_PTHREAD_VERSIONING_WITH_UCLIBC
+#if defined __HAVE_ELF__ && defined __PIC__ && defined DO_VERSIONING
+default_symbol_version (__pthread_attr_init_2_1, pthread_attr_init, GLIBC_2.1);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_1)
int __pthread_attr_init_2_0(pthread_attr_t *attr)
{
attr->__detachstate = PTHREAD_CREATE_JOINABLE;
@@ -90,18 +62,18 @@ int __pthread_attr_init_2_0(pthread_attr_t *attr)
attr->__scope = PTHREAD_SCOPE_SYSTEM;
return 0;
}
-compat_symbol (libpthread, __pthread_attr_init_2_0, pthread_attr_init,
- GLIBC_2_0);
-#endif
+symbol_version (__pthread_attr_init_2_0, pthread_attr_init, GLIBC_2.0);
+#else
+strong_alias (__pthread_attr_init_2_1, pthread_attr_init)
#endif
+#endif /* DO_PTHREAD_VERSIONING_WITH_UCLIBC */
-int __pthread_attr_destroy(pthread_attr_t *attr)
+int pthread_attr_destroy(pthread_attr_t *attr)
{
return 0;
}
-strong_alias (__pthread_attr_destroy, pthread_attr_destroy);
-int __pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
+int pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
{
if (detachstate < PTHREAD_CREATE_JOINABLE ||
detachstate > PTHREAD_CREATE_DETACHED)
@@ -109,17 +81,15 @@ int __pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate)
attr->__detachstate = detachstate;
return 0;
}
-strong_alias (__pthread_attr_setdetachstate, pthread_attr_setdetachstate);
-int __pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
+int pthread_attr_getdetachstate(const pthread_attr_t *attr, int *detachstate)
{
*detachstate = attr->__detachstate;
return 0;
}
-strong_alias (__pthread_attr_getdetachstate, pthread_attr_getdetachstate);
-int __pthread_attr_setschedparam(pthread_attr_t *attr,
- const struct sched_param *param)
+int pthread_attr_setschedparam(pthread_attr_t *attr,
+ const struct sched_param *param)
{
int max_prio = __sched_get_priority_max(attr->__schedpolicy);
int min_prio = __sched_get_priority_min(attr->__schedpolicy);
@@ -129,49 +99,43 @@ int __pthread_attr_setschedparam(pthread_attr_t *attr,
memcpy (&attr->__schedparam, param, sizeof (struct sched_param));
return 0;
}
-strong_alias (__pthread_attr_setschedparam, pthread_attr_setschedparam);
-int __pthread_attr_getschedparam(const pthread_attr_t *attr,
- struct sched_param *param)
+int pthread_attr_getschedparam(const pthread_attr_t *attr,
+ struct sched_param *param)
{
memcpy (param, &attr->__schedparam, sizeof (struct sched_param));
return 0;
}
-strong_alias (__pthread_attr_getschedparam, pthread_attr_getschedparam);
-int __pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
+int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
return EINVAL;
attr->__schedpolicy = policy;
return 0;
}
-strong_alias (__pthread_attr_setschedpolicy, pthread_attr_setschedpolicy);
-int __pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
+int pthread_attr_getschedpolicy(const pthread_attr_t *attr, int *policy)
{
*policy = attr->__schedpolicy;
return 0;
}
-strong_alias (__pthread_attr_getschedpolicy, pthread_attr_getschedpolicy);
-int __pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
+int pthread_attr_setinheritsched(pthread_attr_t *attr, int inherit)
{
if (inherit != PTHREAD_INHERIT_SCHED && inherit != PTHREAD_EXPLICIT_SCHED)
return EINVAL;
attr->__inheritsched = inherit;
return 0;
}
-strong_alias (__pthread_attr_setinheritsched, pthread_attr_setinheritsched);
-int __pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
+int pthread_attr_getinheritsched(const pthread_attr_t *attr, int *inherit)
{
*inherit = attr->__inheritsched;
return 0;
}
-strong_alias (__pthread_attr_getinheritsched, pthread_attr_getinheritsched);
-int __pthread_attr_setscope(pthread_attr_t *attr, int scope)
+int pthread_attr_setscope(pthread_attr_t *attr, int scope)
{
switch (scope) {
case PTHREAD_SCOPE_SYSTEM:
@@ -183,17 +147,20 @@ int __pthread_attr_setscope(pthread_attr_t *attr, int scope)
return EINVAL;
}
}
-strong_alias (__pthread_attr_setscope, pthread_attr_setscope);
-int __pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
+int pthread_attr_getscope(const pthread_attr_t *attr, int *scope)
{
*scope = attr->__scope;
return 0;
}
-strong_alias (__pthread_attr_getscope, pthread_attr_getscope);
int __pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize)
{
+ size_t ps = __getpagesize ();
+
+ /* First round up the guard size. */
+ guardsize = roundup (guardsize, ps);
+
/* The guard size must not be larger than the stack itself */
if (guardsize >= attr->__stacksize) return EINVAL;
@@ -218,9 +185,6 @@ int __pthread_attr_setstackaddr(pthread_attr_t *attr, void *stackaddr)
}
weak_alias (__pthread_attr_setstackaddr, pthread_attr_setstackaddr)
-link_warning (pthread_attr_setstackaddr,
- "the use of `pthread_attr_setstackaddr' is deprecated, use `pthread_attr_setstack'")
-
int __pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
{
/* XXX This function has a stupid definition. The standard specifies
@@ -231,27 +195,8 @@ int __pthread_attr_getstackaddr(const pthread_attr_t *attr, void **stackaddr)
}
weak_alias (__pthread_attr_getstackaddr, pthread_attr_getstackaddr)
-link_warning (pthread_attr_getstackaddr,
- "the use of `pthread_attr_getstackaddr' is deprecated, use `pthread_attr_getstack'")
-
-
int __pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
{
-#ifdef FLOATING_STACKS
- /* We have to check against the maximum allowed stack size. This is no
- problem if the manager is already started and we determined it. If
- this hasn't happened, we have to find the limit outself. */
- if (__pthread_max_stacksize == 0)
- __pthread_init_max_stacksize ();
-
- if (stacksize > __pthread_max_stacksize)
- return EINVAL;
-#else
- /* We have a fixed size limit. */
- if (stacksize > STACK_SIZE)
- return EINVAL;
-#endif
-
/* We don't accept value smaller than PTHREAD_STACK_MIN. */
if (stacksize < PTHREAD_STACK_MIN)
return EINVAL;
@@ -259,45 +204,7 @@ int __pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
attr->__stacksize = stacksize;
return 0;
}
-
-/* Don't bother with this version stuff in uClibc */
-#if 1 /*PTHREAD_STACK_MIN == 16384*/
weak_alias (__pthread_attr_setstacksize, pthread_attr_setstacksize)
-#else
-versioned_symbol (libpthread, __pthread_attr_setstacksize,
- pthread_attr_setstacksize, GLIBC_2_3_3);
-
-# if SHLIB_COMPAT(libpthread, GLIBC_2_1, GLIBC_2_3_3)
-
-int __old_pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize)
-{
-# ifdef FLOATING_STACKS
- /* We have to check against the maximum allowed stack size. This is no
- problem if the manager is already started and we determined it. If
- this hasn't happened, we have to find the limit outself. */
- if (__pthread_max_stacksize == 0)
- __pthread_init_max_stacksize ();
-
- if (stacksize > __pthread_max_stacksize)
- return EINVAL;
-# else
- /* We have a fixed size limit. */
- if (stacksize > STACK_SIZE)
- return EINVAL;
-# endif
-
- /* We don't accept value smaller than old PTHREAD_STACK_MIN. */
- if (stacksize < 16384)
- return EINVAL;
-
- attr->__stacksize = stacksize;
- return 0;
-}
-compat_symbol (libpthread, __old_pthread_attr_setstacksize,
- pthread_attr_setstacksize, GLIBC_2_1);
-# endif
-#endif
-
int __pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
{
@@ -305,215 +212,3 @@ int __pthread_attr_getstacksize(const pthread_attr_t *attr, size_t *stacksize)
return 0;
}
weak_alias (__pthread_attr_getstacksize, pthread_attr_getstacksize)
-
-int __pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr,
- size_t stacksize)
-{
- int err;
-
- if ((((uintptr_t) stackaddr)
- & (__alignof__ (struct _pthread_descr_struct) - 1)) != 0)
- err = EINVAL;
- else
- err = __pthread_attr_setstacksize (attr, stacksize);
- if (err == 0)
- {
-#ifndef _STACK_GROWS_UP
- attr->__stackaddr = (char *) stackaddr + stacksize;
-#else
- attr->__stackaddr = stackaddr;
-#endif
- attr->__stackaddr_set = 1;
- }
-
- return err;
-}
-
-/* Don't bother with this version stuff in uClibc */
-#if 1 /*PTHREAD_STACK_MIN == 16384*/
-weak_alias (__pthread_attr_setstack, pthread_attr_setstack)
-#else
-versioned_symbol (libpthread, __pthread_attr_setstack, pthread_attr_setstack,
- GLIBC_2_3_3);
-# if SHLIB_COMPAT(libpthread, GLIBC_2_2, GLIBC_2_3_3)
-int __old_pthread_attr_setstack (pthread_attr_t *attr, void *stackaddr,
- size_t stacksize)
-{
- int err;
-
- if ((((uintptr_t) stackaddr)
- & (__alignof__ (struct _pthread_descr_struct) - 1)) != 0)
- err = EINVAL;
- else
- err = __old_pthread_attr_setstacksize (attr, stacksize);
- if (err == 0)
- {
-# ifndef _STACK_GROWS_UP
- attr->__stackaddr = (char *) stackaddr + stacksize;
-# else
- attr->__stackaddr = stackaddr;
-# endif
- attr->__stackaddr_set = 1;
- }
-
- return err;
-}
-
-compat_symbol (libpthread, __old_pthread_attr_setstack, pthread_attr_setstack,
- GLIBC_2_2);
-
-# endif
-#endif
-
-int __pthread_attr_getstack (const pthread_attr_t *attr, void **stackaddr,
- size_t *stacksize)
-{
- /* XXX This function has a stupid definition. The standard specifies
- no error value but what is if no stack address was set? We simply
- return the value we have in the member. */
-#ifndef _STACK_GROWS_UP
- *stackaddr = (char *) attr->__stackaddr - attr->__stacksize;
-#else
- *stackaddr = attr->__stackaddr;
-#endif
- *stacksize = attr->__stacksize;
- return 0;
-}
-weak_alias (__pthread_attr_getstack, pthread_attr_getstack)
-
-/* can't fully support this just yet */
-#if 0
-int pthread_getattr_np (pthread_t thread, pthread_attr_t *attr)
-{
- pthread_handle handle = thread_handle (thread);
- pthread_descr descr;
- int ret = 0;
-
- if (handle == NULL)
- return ENOENT;
-
- descr = handle->h_descr;
-
- attr->__detachstate = (descr->p_detached
- ? PTHREAD_CREATE_DETACHED
- : PTHREAD_CREATE_JOINABLE);
-
- attr->__schedpolicy = __sched_getscheduler (descr->p_pid);
- if (attr->__schedpolicy == -1)
- return errno;
-
- if (__sched_getparam (descr->p_pid,
- (struct sched_param *) &attr->__schedparam) != 0)
- return errno;
-
- attr->__inheritsched = descr->p_inheritsched;
- attr->__scope = PTHREAD_SCOPE_SYSTEM;
-
-#ifdef _STACK_GROWS_DOWN
-# ifdef USE_TLS
- attr->__stacksize = descr->p_stackaddr - (char *)descr->p_guardaddr
- - descr->p_guardsize;
-# else
- attr->__stacksize = (char *)(descr + 1) - (char *)descr->p_guardaddr
- - descr->p_guardsize;
-# endif
-#else
-# ifdef USE_TLS
- attr->__stacksize = (char *)descr->p_guardaddr - descr->p_stackaddr;
-# else
- attr->__stacksize = (char *)descr->p_guardaddr - (char *)descr;
-# endif
-#endif
- attr->__guardsize = descr->p_guardsize;
- attr->__stackaddr_set = descr->p_userstack;
-#ifdef NEED_SEPARATE_REGISTER_STACK
- if (descr->p_userstack == 0)
- attr->__stacksize *= 2;
- /* XXX This is awkward. The guard pages are in the middle of the
- two stacks. We must count the guard size in the stack size since
- otherwise the range of the stack area cannot be computed. */
- attr->__stacksize += attr->__guardsize;
-#endif
-#ifdef USE_TLS
- attr->__stackaddr = descr->p_stackaddr;
-#else
-# ifndef _STACK_GROWS_UP
- attr->__stackaddr = (char *)(descr + 1);
-# else
- attr->__stackaddr = (char *)descr;
-# endif
-#endif
-
-#ifdef USE_TLS
- if (attr->__stackaddr == NULL)
-#else
- if (descr == &__pthread_initial_thread)
-#endif
- {
- /* Stack size limit. */
- struct rlimit rl;
-
- /* The safest way to get the top of the stack is to read
- /proc/self/maps and locate the line into which
- __libc_stack_end falls. */
- FILE *fp = fopen ("/proc/self/maps", "rc");
- if (fp == NULL)
- ret = errno;
- /* We need the limit of the stack in any case. */
- else if (getrlimit (RLIMIT_STACK, &rl) != 0)
- ret = errno;
- else
- {
- /* We need no locking. */
- __fsetlocking (fp, FSETLOCKING_BYCALLER);
-
- /* Until we found an entry (which should always be the case)
- mark the result as a failure. */
- ret = ENOENT;
-
- char *line = NULL;
- size_t linelen = 0;
- uintptr_t last_to = 0;
-
- while (! feof_unlocked (fp))
- {
- if (__getdelim (&line, &linelen, '\n', fp) <= 0)
- break;
-
- uintptr_t from;
- uintptr_t to;
- if (sscanf (line, "%" SCNxPTR "-%" SCNxPTR, &from, &to) != 2)
- continue;
- if (from <= (uintptr_t) __libc_stack_end
- && (uintptr_t) __libc_stack_end < to)
- {
- /* Found the entry. Now we have the info we need. */
- attr->__stacksize = rl.rlim_cur;
-#ifdef _STACK_GROWS_UP
- /* Don't check to enforce a limit on the __stacksize */
- attr->__stackaddr = (void *) from;
-#else
- attr->__stackaddr = (void *) to;
-
- /* The limit might be too high. */
- if ((size_t) attr->__stacksize
- > (size_t) attr->__stackaddr - last_to)
- attr->__stacksize = (size_t) attr->__stackaddr - last_to;
-#endif
-
- /* We succeed and no need to look further. */
- ret = 0;
- break;
- }
- last_to = to;
- }
-
- fclose (fp);
- free (line);
- }
- }
-
- return 0;
-
-}
-#endif
diff --git a/libpthread/linuxthreads/cancel.c b/libpthread/linuxthreads/cancel.c
index dbba7eef4..1356348a7 100644
--- a/libpthread/linuxthreads/cancel.c
+++ b/libpthread/linuxthreads/cancel.c
@@ -26,14 +26,6 @@
extern void __rpc_thread_destroy(void);
#endif
-#ifdef _STACK_GROWS_DOWN
-# define FRAME_LEFT(frame, other) ((char *) frame >= (char *) other)
-#elif _STACK_GROWS_UP
-# define FRAME_LEFT(frame, other) ((char *) frame <= (char *) other)
-#else
-# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
-#endif
-
int pthread_setcancelstate(int state, int * oldstate)
{
@@ -70,31 +62,28 @@ int pthread_cancel(pthread_t thread)
int dorestart = 0;
pthread_descr th;
pthread_extricate_if *pextricate;
- int already_canceled;
__pthread_lock(&handle->h_lock, NULL);
- if (nonexisting_handle(handle, thread)) {
+ if (invalid_handle(handle, thread)) {
__pthread_unlock(&handle->h_lock);
return ESRCH;
}
th = handle->h_descr;
- already_canceled = th->p_canceled;
- th->p_canceled = 1;
-
- if (th->p_cancelstate == PTHREAD_CANCEL_DISABLE || already_canceled) {
+ if (th->p_canceled) {
__pthread_unlock(&handle->h_lock);
return 0;
}
pextricate = th->p_extricate;
+ th->p_canceled = 1;
pid = th->p_pid;
/* If the thread has registered an extrication interface, then
invoke the interface. If it returns 1, then we succeeded in
dequeuing the thread from whatever waiting object it was enqueued
- with. In that case, it is our responsibility to wake it up.
+ with. In that case, it is our responsibility to wake it up.
And also to set the p_woken_by_cancel flag so the woken thread
can tell that it was woken by cancellation. */
@@ -136,8 +125,6 @@ void _pthread_cleanup_push(struct _pthread_cleanup_buffer * buffer,
buffer->__routine = routine;
buffer->__arg = arg;
buffer->__prev = THREAD_GETMEM(self, p_cleanup);
- if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev))
- buffer->__prev = NULL;
THREAD_SETMEM(self, p_cleanup, buffer);
}
@@ -157,8 +144,6 @@ void _pthread_cleanup_push_defer(struct _pthread_cleanup_buffer * buffer,
buffer->__arg = arg;
buffer->__canceltype = THREAD_GETMEM(self, p_canceltype);
buffer->__prev = THREAD_GETMEM(self, p_cleanup);
- if (buffer->__prev != NULL && FRAME_LEFT (buffer, buffer->__prev))
- buffer->__prev = NULL;
THREAD_SETMEM(self, p_canceltype, PTHREAD_CANCEL_DEFERRED);
THREAD_SETMEM(self, p_cleanup, buffer);
}
diff --git a/libpthread/linuxthreads/condvar.c b/libpthread/linuxthreads/condvar.c
index b051afd4c..f9c46a331 100644
--- a/libpthread/linuxthreads/condvar.c
+++ b/libpthread/linuxthreads/condvar.c
@@ -25,52 +25,19 @@
#include "queue.h"
#include "restart.h"
-/* glibc uses strong aliases, we wont bother */
-#undef strong_alias
-#define strong_alias(sym, alias)
-#define __pthread_cond_init pthread_cond_init
-#define __pthread_cond_destroy pthread_cond_destroy
-#define __pthread_cond_wait pthread_cond_wait
-#define __pthread_cond_timedwait pthread_cond_timedwait
-#define __pthread_cond_signal pthread_cond_signal
-#define __pthread_cond_broadcast pthread_cond_broadcast
-#define __pthread_condattr_init pthread_condattr_init
-#define __pthread_condattr_destroy pthread_condattr_destroy
-
-
-int __pthread_cond_init(pthread_cond_t *cond,
- const pthread_condattr_t *cond_attr)
+int pthread_cond_init(pthread_cond_t *cond,
+ const pthread_condattr_t *cond_attr)
{
__pthread_init_lock(&cond->__c_lock);
cond->__c_waiting = NULL;
return 0;
}
-/* Don't bother with this version stuff in uClibc */
-#if 0
-versioned_symbol (libpthread, __pthread_cond_init, pthread_cond_init,
- GLIBC_2_3_2);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
-strong_alias (__pthread_cond_init, __old_pthread_cond_init)
-compat_symbol (libpthread, __old_pthread_cond_init, pthread_cond_init,
- GLIBC_2_0);
-#endif
-#endif
-
-int __pthread_cond_destroy(pthread_cond_t *cond)
+
+int pthread_cond_destroy(pthread_cond_t *cond)
{
if (cond->__c_waiting != NULL) return EBUSY;
return 0;
}
-/* Don't bother with this version stuff in uClibc */
-#if 0
-versioned_symbol (libpthread, __pthread_cond_destroy, pthread_cond_destroy,
- GLIBC_2_3_2);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
-strong_alias (__pthread_cond_destroy, __old_pthread_cond_destroy)
-compat_symbol (libpthread, __old_pthread_cond_destroy, pthread_cond_destroy,
- GLIBC_2_0);
-#endif
-#endif
/* Function called by pthread_cancel to remove the thread from
waiting on a condition variable queue. */
@@ -88,7 +55,7 @@ static int cond_extricate_func(void *obj, pthread_descr th)
return did_remove;
}
-int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
+int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
volatile pthread_descr self = thread_self();
pthread_extricate_if extr;
@@ -165,16 +132,6 @@ int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
pthread_mutex_lock(mutex);
return 0;
}
-/* Don't bother with this version stuff in uClibc */
-#if 0
-versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_3_2);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
-strong_alias (__pthread_cond_wait, __old_pthread_cond_wait)
-compat_symbol (libpthread, __old_pthread_cond_wait, pthread_cond_wait,
- GLIBC_2_0);
-#endif
-#endif
static int
pthread_cond_timedwait_relative(pthread_cond_t *cond,
@@ -270,24 +227,14 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond,
return 0;
}
-int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
- const struct timespec * abstime)
+int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
+ const struct timespec * abstime)
{
/* Indirect call through pointer! */
return pthread_cond_timedwait_relative(cond, mutex, abstime);
}
-/* Don't bother with this version stuff in uClibc */
-#if 0
-versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
- GLIBC_2_3_2);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
-strong_alias (__pthread_cond_timedwait, __old_pthread_cond_timedwait)
-compat_symbol (libpthread, __old_pthread_cond_timedwait,
- pthread_cond_timedwait, GLIBC_2_0);
-#endif
-#endif
-
-int __pthread_cond_signal(pthread_cond_t *cond)
+
+int pthread_cond_signal(pthread_cond_t *cond)
{
pthread_descr th;
@@ -301,18 +248,8 @@ int __pthread_cond_signal(pthread_cond_t *cond)
}
return 0;
}
-/* Don't bother with this version stuff in uClibc */
-#if 0
-versioned_symbol (libpthread, __pthread_cond_signal, pthread_cond_signal,
- GLIBC_2_3_2);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
-strong_alias (__pthread_cond_signal, __old_pthread_cond_signal)
-compat_symbol (libpthread, __old_pthread_cond_signal, pthread_cond_signal,
- GLIBC_2_0);
-#endif
-#endif
-
-int __pthread_cond_broadcast(pthread_cond_t *cond)
+
+int pthread_cond_broadcast(pthread_cond_t *cond)
{
pthread_descr tosignal, th;
@@ -329,28 +266,16 @@ int __pthread_cond_broadcast(pthread_cond_t *cond)
}
return 0;
}
-/* Don't bother with this version stuff in uClibc */
-#if 0
-versioned_symbol (libpthread, __pthread_cond_broadcast, pthread_cond_broadcast,
- GLIBC_2_3_2);
-#if SHLIB_COMPAT(libpthread, GLIBC_2_0, GLIBC_2_3_2)
-strong_alias (__pthread_cond_broadcast, __old_pthread_cond_broadcast)
-compat_symbol (libpthread, __old_pthread_cond_broadcast,
- pthread_cond_broadcast, GLIBC_2_0);
-#endif
-#endif
-
-int __pthread_condattr_init(pthread_condattr_t *attr)
+
+int pthread_condattr_init(pthread_condattr_t *attr)
{
return 0;
}
-strong_alias (__pthread_condattr_init, pthread_condattr_init)
-int __pthread_condattr_destroy(pthread_condattr_t *attr)
+int pthread_condattr_destroy(pthread_condattr_t *attr)
{
return 0;
}
-strong_alias (__pthread_condattr_destroy, pthread_condattr_destroy)
int pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared)
{
diff --git a/libpthread/linuxthreads/descr.h b/libpthread/linuxthreads/descr.h
deleted file mode 100644
index fb5fa350e..000000000
--- a/libpthread/linuxthreads/descr.h
+++ /dev/null
@@ -1,313 +0,0 @@
-/* Linuxthreads - a simple clone()-based implementation of Posix */
-/* threads for Linux. */
-/* Copyright (C) 1996 Xavier Leroy (Xavier.Leroy@inria.fr) */
-/* */
-/* This program is free software; you can redistribute it and/or */
-/* modify it under the terms of the GNU Library General Public License */
-/* as published by the Free Software Foundation; either version 2 */
-/* of the License, or (at your option) any later version. */
-/* */
-/* This program 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 Library General Public License for more details. */
-
-#ifndef _DESCR_H
-#define _DESCR_H 1
-
-#include <features.h>
-#include <sched.h>
-#include <setjmp.h>
-#include <signal.h>
-#include <stdint.h>
-#include <sys/types.h>
-#include <tls.h>
-
-#if 1
-# include <bits/libc-tsd.h>
-#else
-/* Fast thread-specific data internal to libc. */
-enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0,
- _LIBC_TSD_KEY_DL_ERROR,
- _LIBC_TSD_KEY_RPC_VARS,
- _LIBC_TSD_KEY_LOCALE,
- _LIBC_TSD_KEY_CTYPE_B,
- _LIBC_TSD_KEY_CTYPE_TOLOWER,
- _LIBC_TSD_KEY_CTYPE_TOUPPER,
- _LIBC_TSD_KEY_N };
-#endif
-
-/* The type of thread descriptors */
-typedef struct _pthread_descr_struct *pthread_descr;
-
-
-/* Some more includes. */
-#include <pt-machine.h>
-#include "../linuxthreads_db/thread_dbP.h"
-
-
-/* Arguments passed to thread creation routine */
-struct pthread_start_args {
- void *(*start_routine)(void *); /* function to run */
- void *arg; /* its argument */
- sigset_t mask; /* initial signal mask for thread */
- int schedpolicy; /* initial scheduling policy (if any) */
- struct sched_param schedparam; /* initial scheduling parameters (if any) */
-};
-
-
-/* Callback interface for removing the thread from waiting on an
- object if it is cancelled while waiting or about to wait.
- This hold a pointer to the object, and a pointer to a function
- which ``extricates'' the thread from its enqueued state.
- The function takes two arguments: pointer to the wait object,
- and a pointer to the thread. It returns 1 if an extrication
- actually occured, and hence the thread must also be signalled.
- It returns 0 if the thread had already been extricated. */
-typedef struct _pthread_extricate_struct {
- void *pu_object;
- int (*pu_extricate_func)(void *, pthread_descr);
-} pthread_extricate_if;
-
-
-/* Atomic counter made possible by compare_and_swap */
-struct pthread_atomic {
- long p_count;
- int p_spinlock;
-};
-
-
-/* Context info for read write locks. The pthread_rwlock_info structure
- is information about a lock that has been read-locked by the thread
- in whose list this structure appears. The pthread_rwlock_context
- is embedded in the thread context and contains a pointer to the
- head of the list of lock info structures, as well as a count of
- read locks that are untracked, because no info structure could be
- allocated for them. */
-struct _pthread_rwlock_t;
-typedef struct _pthread_rwlock_info {
- struct _pthread_rwlock_info *pr_next;
- struct _pthread_rwlock_t *pr_lock;
- int pr_lock_count;
-} pthread_readlock_info;
-
-
-/* We keep thread specific data in a special data structure, a two-level
- array. The top-level array contains pointers to dynamically allocated
- arrays of a certain number of data pointers. So we can implement a
- sparse array. Each dynamic second-level array has
- PTHREAD_KEY_2NDLEVEL_SIZE
- entries. This value shouldn't be too large. */
-#define PTHREAD_KEY_2NDLEVEL_SIZE 32
-
-/* We need to address PTHREAD_KEYS_MAX key with PTHREAD_KEY_2NDLEVEL_SIZE
- keys in each subarray. */
-#define PTHREAD_KEY_1STLEVEL_SIZE \
- ((PTHREAD_KEYS_MAX + PTHREAD_KEY_2NDLEVEL_SIZE - 1) \
- / PTHREAD_KEY_2NDLEVEL_SIZE)
-
-
-union dtv;
-
-struct _pthread_descr_struct
-{
-#if !defined USE_TLS || !TLS_DTV_AT_TP
- /* This overlaps tcbhead_t (see tls.h), as used for TLS without threads. */
- union
- {
- struct
- {
- void *tcb; /* Pointer to the TCB. This is not always
- the address of this thread descriptor. */
- union dtv *dtvp;
- pthread_descr self; /* Pointer to this structure */
- int multiple_threads;
-# ifdef NEED_DL_SYSINFO
- uintptr_t sysinfo;
-# endif
- } data;
- void *__padding[16];
- } p_header;
-# define p_multiple_threads p_header.data.multiple_threads
-#elif TLS_MULTIPLE_THREADS_IN_TCB
- int p_multiple_threads;
-#endif
-
- pthread_descr p_nextlive, p_prevlive;
- /* Double chaining of active threads */
- pthread_descr p_nextwaiting; /* Next element in the queue holding the thr */
- pthread_descr p_nextlock; /* can be on a queue and waiting on a lock */
- pthread_t p_tid; /* Thread identifier */
- int p_pid; /* PID of Unix process */
- int p_priority; /* Thread priority (== 0 if not realtime) */
- struct _pthread_fastlock * p_lock; /* Spinlock for synchronized accesses */
- int p_signal; /* last signal received */
- sigjmp_buf * p_signal_jmp; /* where to siglongjmp on a signal or NULL */
- sigjmp_buf * p_cancel_jmp; /* where to siglongjmp on a cancel or NULL */
- char p_terminated; /* true if terminated e.g. by pthread_exit */
- char p_detached; /* true if detached */
- char p_exited; /* true if the assoc. process terminated */
- void * p_retval; /* placeholder for return value */
- int p_retcode; /* placeholder for return code */
- pthread_descr p_joining; /* thread joining on that thread or NULL */
- struct _pthread_cleanup_buffer * p_cleanup; /* cleanup functions */
- char p_cancelstate; /* cancellation state */
- char p_canceltype; /* cancellation type (deferred/async) */
- char p_canceled; /* cancellation request pending */
- char * p_in_sighandler; /* stack address of sighandle