diff options
Diffstat (limited to 'linuxthreads')
24 files changed, 146 insertions, 35 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index e05e7c0..e7b3819 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,45 @@ +2000-12-27 Andreas Jaeger <aj@suse.de> + + * Examples/ex13.c: Make local functions static. + * ecmutex.c: Likewise. + * Examples/ex14.c: Likewise. + + * Examples/ex2.c: Make local functions static; reformat. + * Examples/ex1.c: Likewise. + * Examples/ex4.c: Likewise. + * Examples/ex5.c: Likewise. + * Examples/ex7.c: Likewise. + + * oldsemaphore.c: Add prototypes to shut up GCC. + * pt-machine.c: Likewise. + + * weaks.c: Add prototype for pthread_exit. + + * internals.h: Add some prototypes, format prototypes and add + missing externs. + Move __libc_waitpid prototype to include/sys/wait.h. + + * rwlock.c: Include <bits/libc-lock.h> for prototypes. + * mutex.c: Likewise. + * specific.c: Likewise. + * ptfork.c: Likewise. + + * lockfile.c: Include internals.h to get prototypes. + * events.c: Likewise. + * sysdeps/alpha/pspinlock.c: Likewise. + * sysdeps/arm/pspinlock.c: Likewise. + * sysdeps/hppa/pspinlock.c: Likewise. + * sysdeps/i386/pspinlock.c: Likewise. + * sysdeps/ia64/pspinlock.c: Likewise. + * sysdeps/m68k/pspinlock.c: Likewise. + * sysdeps/mips/pspinlock.c: Likewise. + * sysdeps/powerpc/pspinlock.c: Likewise. + * sysdeps/s390/pspinlock.c: Likewise. + * sysdeps/sh/pspinlock.c: Likewise. + * sysdeps/sparc/sparc32/pspinlock.c: Likewise. + * sysdeps/sparc/sparc32/sparcv9/pspinlock.c: Likewise. + * sysdeps/sparc/sparc64/pspinlock.c: Likewise. + 2000-12-27 Ulrich Drepper <drepper@redhat.com> * attr.c (__pthread_attr_setstack): Fix setting of __stackaddr element. diff --git a/linuxthreads/events.c b/linuxthreads/events.c index e5be3d9..c65bafc 100644 --- a/linuxthreads/events.c +++ b/linuxthreads/events.c @@ -1,5 +1,5 @@ /* Event functions used while debugging. - Copyright (C) 1999 Free Software Foundation, Inc. + Copyright (C) 1999, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -19,6 +19,8 @@ /* The functions contained here do nothing, they just return. */ +#include "internals.h" + void __linuxthreads_create_event (void) { diff --git a/linuxthreads/internals.h b/linuxthreads/internals.h index b81e5f4..9480530 100644 --- a/linuxthreads/internals.h +++ b/linuxthreads/internals.h @@ -427,21 +427,22 @@ static inline pthread_descr thread_self (void) /* Internal global functions */ -void __pthread_destroy_specifics(void); -void __pthread_perform_cleanup(void); -int __pthread_initialize_manager(void); -void __pthread_message(char * fmt, ...); -int __pthread_manager(void *reqfd); -int __pthread_manager_event(void *reqfd); -void __pthread_manager_sighandler(int sig); -void __pthread_reset_main_thread(void); -void __pthread_once_fork_prepare(void); -void __pthread_once_fork_parent(void); -void __pthread_once_fork_child(void); -void __flockfilelist(void); -void __funlockfilelist(void); -void __fresetlockfiles(void); -void __pthread_manager_adjust_prio(int thread_prio); +extern void __pthread_destroy_specifics (void); +extern void __pthread_perform_cleanup (void); +extern int __pthread_initialize_manager (void); +extern void __pthread_message (char * fmt, ...); +extern int __pthread_manager (void *reqfd); +extern int __pthread_manager_event (void *reqfd); +extern void __pthread_manager_sighandler (int sig); +extern void __pthread_reset_main_thread (void); +extern void __pthread_once_fork_prepare (void); +extern void __pthread_once_fork_parent (void); +extern void __pthread_once_fork_child (void); +extern void __flockfilelist (void); +extern void __funlockfilelist (void); +extern void __fresetlockfiles (void); +extern void __pthread_manager_adjust_prio (int thread_prio); +extern void __pthread_initialize_minimal (void); extern int __pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize); @@ -455,23 +456,52 @@ extern int __pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize); extern int __pthread_attr_getstacksize (const pthread_attr_t *__attr, size_t *__stacksize); +extern int __pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr, + size_t __stacksize); +extern int __pthread_attr_getstack (const pthread_attr_t *__attr, void **__stackaddr, + size_t *__stacksize); extern int __pthread_getconcurrency (void); extern int __pthread_setconcurrency (int __level); +extern int __pthread_mutex_timedlock (pthread_mutex_t *__mutex, + const struct timespec *__abstime); +extern int __pthread_mutexattr_getpshared (const pthread_mutexattr_t *__attr, + int *__pshared); +extern int __pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, + int __pshared); extern int __pthread_mutexattr_gettype (const pthread_mutexattr_t *__attr, int *__kind); extern void __pthread_kill_other_threads_np (void); -void __pthread_restart_old(pthread_descr th); -void __pthread_suspend_old(pthread_descr self); -int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abs); +extern void __pthread_restart_old(pthread_descr th); +extern void __pthread_suspend_old(pthread_descr self); +extern int __pthread_timedsuspend_old(pthread_descr self, const struct timespec *abs); -void __pthread_restart_new(pthread_descr th); -void __pthread_suspend_new(pthread_descr self); -int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abs); +extern void __pthread_restart_new(pthread_descr th); +extern void __pthread_suspend_new(pthread_descr self); +extern int __pthread_timedsuspend_new(pthread_descr self, const struct timespec *abs); -void __pthread_wait_for_restart_signal(pthread_descr self); +extern void __pthread_wait_for_restart_signal(pthread_descr self); + +extern int __pthread_yield (void); + +extern int __pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, + __const struct timespec *__restrict + __abstime); +extern int __pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, + __const struct timespec *__restrict + __abstime); +extern int __pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr); + +extern int __pthread_barrierattr_getpshared (__const pthread_barrierattr_t * + __restrict __attr, + int *__restrict __pshared); + +extern int __pthread_spin_lock (pthread_spinlock_t *__lock); +extern int __pthread_spin_trylock (pthread_spinlock_t *__lock); +extern int __pthread_spin_unlock (pthread_spinlock_t *__lock); +extern int __pthread_spin_init (pthread_spinlock_t *__lock, int __pshared); +extern int __pthread_spin_destroy (pthread_spinlock_t *__lock); -int __pthread_yield (void); /* Global pointers to old or new suspend functions */ @@ -484,10 +514,25 @@ extern int (*__pthread_timedsuspend)(pthread_descr, const struct timespec *); extern int __libc_close (int fd); extern int __libc_nanosleep (const struct timespec *requested_time, struct timespec *remaining); -extern pid_t __libc_waitpid (pid_t pid, int *stat_loc, int options); - /* Prototypes for some of the new semaphore functions. */ extern int __new_sem_post (sem_t * sem); +extern int __new_sem_init (sem_t *__sem, int __pshared, unsigned int __value); +extern int __new_sem_wait (sem_t *__sem); +extern int __new_sem_trywait (sem_t *__sem); +extern int __new_sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval); +extern int __new_sem_destroy (sem_t *__sem); + +/* Prototypes for compatibility functions. */ +extern int __pthread_attr_init_2_1 (pthread_attr_t *__attr); +extern int __pthread_attr_init_2_0 (pthread_attr_t *__attr); +extern int __pthread_create_2_1 (pthread_t *__restrict __thread, + const pthread_attr_t *__attr, + void *(*__start_routine) (void *), + void *__restrict __arg); +extern int __pthread_create_2_0 (pthread_t *__restrict thread, + const pthread_attr_t *__attr, + void *(*__start_routine) (void *), + void *__restrict arg); /* The functions called the signal events. */ extern void __linuxthreads_create_event (void); diff --git a/linuxthreads/lockfile.c b/linuxthreads/lockfile.c index 0ef02f8..38fa3fb 100644 --- a/linuxthreads/lockfile.c +++ b/linuxthreads/lockfile.c @@ -20,6 +20,7 @@ #include <bits/libc-lock.h> #include <stdio.h> #include <pthread.h> +#include "internals.h" #ifdef USE_IN_LIBIO #include "../libio/libioP.h" diff --git a/linuxthreads/mutex.c b/linuxthreads/mutex.c index 5955c57..3ad2794 100644 --- a/linuxthreads/mutex.c +++ b/linuxthreads/mutex.c @@ -14,6 +14,7 @@ /* Mutexes */ +#include <bits/libc-lock.h> #include <errno.h> #include <sched.h> #include <stddef.h> diff --git a/linuxthreads/oldsemaphore.c b/linuxthreads/oldsemaphore.c index b9eb20f..82cd637 100644 --- a/linuxthreads/oldsemaphore.c +++ b/linuxthreads/oldsemaphore.c @@ -34,6 +34,14 @@ typedef struct { int sem_spinlock; } old_sem_t; +extern int __old_sem_init (old_sem_t *__sem, int __pshared, unsigned int __value); +extern int __old_sem_wait (old_sem_t *__sem); +extern int __old_sem_trywait (old_sem_t *__sem); +extern int __old_sem_post (old_sem_t *__sem); +extern int __old_sem_getvalue (old_sem_t *__sem, int *__sval); +extern int __old_sem_destroy (old_sem_t *__sem); + + /* Maximum value the semaphore can have. */ #define SEM_VALUE_MAX ((int) ((~0u) >> 1)) diff --git a/linuxthreads/pt-machine.c b/linuxthreads/pt-machine.c index 438008d..f6298c4 100644 --- a/linuxthreads/pt-machine.c +++ b/linuxthreads/pt-machine.c @@ -19,4 +19,7 @@ #define PT_EI +extern long int testandset (int *spinlock); +extern int __compare_and_swap (long int *p, long int oldval, long int newval); + #include <pt-machine.h> diff --git a/linuxthreads/ptfork.c b/linuxthreads/ptfork.c index deb347f..564f8d7 100644 --- a/linuxthreads/ptfork.c +++ b/linuxthreads/ptfork.c @@ -20,6 +20,7 @@ #include <unistd.h> #include "pthread.h" #include "internals.h" +#include <bits/libc-lock.h> struct handler_list { void (*handler)(void); diff --git a/linuxthreads/rwlock.c b/linuxthreads/rwlock.c index 635f465..6af57cd 100644 --- a/linuxthreads/rwlock.c +++ b/linuxthreads/rwlock.c @@ -19,6 +19,7 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include <bits/libc-lock.h> #include <errno.h> #include <pthread.h> #include <stdlib.h> diff --git a/linuxthreads/specific.c b/linuxthreads/specific.c index 10697af..a7fa8ff 100644 --- a/linuxthreads/specific.c +++ b/linuxthreads/specific.c @@ -20,6 +20,8 @@ #include "pthread.h" #include "internals.h" #include "spinlock.h" +#include <bits/libc-lock.h> + /* Table of keys. */ diff --git a/linuxthreads/sysdeps/alpha/pspinlock.c b/linuxthreads/sysdeps/alpha/pspinlock.c index 0d871b4..574c638 100644 --- a/linuxthreads/sysdeps/alpha/pspinlock.c +++ b/linuxthreads/sysdeps/alpha/pspinlock.c @@ -19,6 +19,7 @@ #include <errno.h> #include <pthread.h> +#include "internals.h" /* This implementation is similar to the one used in the Linux kernel. diff --git a/linuxthreads/sysdeps/arm/pspinlock.c b/linuxthreads/sysdeps/arm/pspinlock.c index a56881a..010ad33 100644 --- a/linuxthreads/sysdeps/arm/pspinlock.c +++ b/linuxthreads/sysdeps/arm/pspinlock.c @@ -19,6 +19,7 @@ #include <errno.h> #include <pthread.h> +#include "internals.h" int diff --git a/linuxthreads/sysdeps/hppa/pspinlock.c b/linuxthreads/sysdeps/hppa/pspinlock.c index 1b1511f..6a858bf 100644 --- a/linuxthreads/sysdeps/hppa/pspinlock.c +++ b/linuxthreads/sysdeps/hppa/pspinlock.c @@ -19,7 +19,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" int __pthread_spin_lock (pthread_spinlock_t *lock) diff --git a/linuxthreads/sysdeps/i386/pspinlock.c b/linuxthreads/sysdeps/i386/pspinlock.c index 426e63a..5d24238 100644 --- a/linuxthreads/sysdeps/i386/pspinlock.c +++ b/linuxthreads/sysdeps/i386/pspinlock.c @@ -19,7 +19,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" /* This implementation is similar to the one used in the Linux kernel. But the kernel is byte instructions for the memory access. This is diff --git a/linuxthreads/sysdeps/ia64/pspinlock.c b/linuxthreads/sysdeps/ia64/pspinlock.c index ada28bd..174e38d 100644 --- a/linuxthreads/sysdeps/ia64/pspinlock.c +++ b/linuxthreads/sysdeps/ia64/pspinlock.c @@ -20,7 +20,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" /* This implementation is inspired by the implementation used in the Linux kernel. */ diff --git a/linuxthreads/sysdeps/m68k/pspinlock.c b/linuxthreads/sysdeps/m68k/pspinlock.c index 994adc8..38e490f 100644 --- a/linuxthreads/sysdeps/m68k/pspinlock.c +++ b/linuxthreads/sysdeps/m68k/pspinlock.c @@ -19,6 +19,7 @@ #include <errno.h> #include <pthread.h> +#include "internals.h" int diff --git a/linuxthreads/sysdeps/mips/pspinlock.c b/linuxthreads/sysdeps/mips/pspinlock.c index 7df3040..ab73d1d 100644 --- a/linuxthreads/sysdeps/mips/pspinlock.c +++ b/linuxthreads/sysdeps/mips/pspinlock.c @@ -21,7 +21,7 @@ #include <pthread.h> #include <sgidefs.h> #include <sys/tas.h> - +#include "internals.h" #if (_MIPS_ISA >= _MIPS_ISA_MIPS2) diff --git a/linuxthreads/sysdeps/powerpc/pspinlock.c b/linuxthreads/sysdeps/powerpc/pspinlock.c index 77cad0c..80e2727 100644 --- a/linuxthreads/sysdeps/powerpc/pspinlock.c +++ b/linuxthreads/sysdeps/powerpc/pspinlock.c @@ -20,7 +20,7 @@ #include <errno.h> #include <pthread.h> #include <pt-machine.h> - +#include "internals.h" int __pthread_spin_lock (pthread_spinlock_t *lock) diff --git a/linuxthreads/sysdeps/s390/pspinlock.c b/linuxthreads/sysdeps/s390/pspinlock.c index 08231bf..eeca51f 100644 --- a/linuxthreads/sysdeps/s390/pspinlock.c +++ b/linuxthreads/sysdeps/s390/pspinlock.c @@ -20,7 +20,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" /* This implementation is similar to the one used in the Linux kernel. But the kernel is byte instructions for the memory access. This is diff --git a/linuxthreads/sysdeps/sh/pspinlock.c b/linuxthreads/sysdeps/sh/pspinlock.c index be9fc80..2da3bc4 100644 --- a/linuxthreads/sysdeps/sh/pspinlock.c +++ b/linuxthreads/sysdeps/sh/pspinlock.c @@ -19,7 +19,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" int __pthread_spin_lock (pthread_spinlock_t *lock) diff --git a/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c b/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c index 1788d7a..be11817 100644 --- a/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c +++ b/linuxthreads/sysdeps/sparc/sparc32/pspinlock.c @@ -19,7 +19,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" /* This implementation is similar to the one used in the Linux kernel. */ int diff --git a/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c b/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c index 99ffdc0..a762650 100644 --- a/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c +++ b/linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c @@ -19,6 +19,7 @@ #include <errno.h> #include <pthread.h> +#include "internals.h" /* This implementation is similar to the one used in the Linux kernel. */ diff --git a/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c b/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c index 1b7fa15..2106e44 100644 --- a/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c +++ b/linuxthreads/sysdeps/sparc/sparc64/pspinlock.c @@ -19,7 +19,7 @@ #include <errno.h> #include <pthread.h> - +#include "internals.h" /* This implementation is similar to the one used in the Linux kernel. */ int diff --git a/linuxthreads/weaks.c b/linuxthreads/weaks.c index 163f232..948b893 100644 --- a/linuxthreads/weaks.c +++ b/linuxthreads/weaks.c @@ -26,6 +26,7 @@ extern int __pthread_return_0 (void); extern int __pthread_return_1 (void); extern void __pthread_return_void (void); +extern void weak_function pthread_exit (void *__retval); /* Those are pthread functions which return 0 if successful. */ weak_alias (__pthread_return_0, BP_SYM (__libc_pthread_attr_init_2_1)) |