diff options
| -rw-r--r-- | libpthread/nptl/ANNOUNCE | 92 | ||||
| -rw-r--r-- | libpthread/nptl/DESIGN-barrier.txt | 44 | ||||
| -rw-r--r-- | libpthread/nptl/DESIGN-condvar.txt | 134 | ||||
| -rw-r--r-- | libpthread/nptl/DESIGN-rwlock.txt | 113 | ||||
| -rw-r--r-- | libpthread/nptl/DESIGN-sem.txt | 46 | ||||
| -rw-r--r-- | libpthread/nptl/TODO | 12 | ||||
| -rw-r--r-- | libpthread/nptl/TODO-kernel | 20 | ||||
| -rw-r--r-- | libpthread/nptl/TODO-testing | 20 | ||||
| -rw-r--r-- | libpthread/nptl/pt-allocrtsig.c | 51 | ||||
| -rw-r--r-- | libpthread/nptl/sysdeps/pthread/pt-longjmp.c | 29 | ||||
| -rw-r--r-- | libpthread/nptl/sysdeps/unix/sysv/linux/aio_misc.h | 67 | ||||
| -rw-r--r-- | libpthread/nptl/sysdeps/unix/sysv/linux/allocrtsig.c | 56 |
12 files changed, 0 insertions, 684 deletions
diff --git a/libpthread/nptl/ANNOUNCE b/libpthread/nptl/ANNOUNCE deleted file mode 100644 index b63c657b8..000000000 --- a/libpthread/nptl/ANNOUNCE +++ /dev/null @@ -1,92 +0,0 @@ -Now that the Linux kernel is once again able to run all the tests we -have and since glibc 2.3 was released it was time for a new code drop. -I've uploaded the second code drop for the Native POSIX Thread -Library: - - ftp://people.redhat.com/drepper/nptl/nptl-0.2.tar.bz2 - -You need - -- the latest of Linus' kernel from BitKeeper (or 2.5.41 when it - is released); - -- glibc 2.3 - -- the very latest in tools such as - - + gcc either from the current development branch or the gcc 3.2 - from Red Hat Linux 8; - - + binutils preferrably from CVS, from H.J. Lu's latest release for - Linux, or from RHL 8. - - -Compiling glibc should proceed smoothly. But there are a number of -tests which fail, mostly because some functionality is missing in -glibc. Ignore those errors. It is only important that all tests in -nptl/ are passing. Run - - make subdirs=nptl check - -to run all thread tests. - - -This version features several improvements: - -- all APIs are now implemented; - -- fork handling has been improved; stacks in the child are freed; - atfork handlers are removed if they were registered from a module - which gets unloaded. - -- pthread_tryjoin_np and pthread_timedjoin_np are implemented - -- TSD handling corrected and optimized. - -- many more tests which also test the underlying kernel implementation. - -- the build infrastructure has been implemented so that the DSO and - archives are built in usable form and with correct named. - -- libthread_db has been implemented. This is the library which is - needed by all program which need to get access to internals of - libpthread (mainly debuggers). - -- the CPU clock functions are implemented - - - -The white paper hasn't yet been updated. It's still available at - - http://people.redhat.com/drepper/nptl-design.pdf - - -This release should be ready for some serious testing. I know it is -hard to compile which I why I'm looking into providing binary RPMs. -They can be used on non-critical systems. I'll only be able to -provide binaries for RHL8 based systems, though, and the kernel still -must be installed separately. - - -The next steps will include: - -- write more tests and fix the bugs which are discovered this way - -- update the white paper - -- write and run more performance tests - -- port to IA-64 - - -Interested parties are once again invited to join the mailing we -created: - - - phil-list@redhat.com - -Go to - - https://listman.redhat.com/mailman/listinfo/phil-list - -to subscribe, unsubscribe, or review the archive. diff --git a/libpthread/nptl/DESIGN-barrier.txt b/libpthread/nptl/DESIGN-barrier.txt deleted file mode 100644 index 23463c6b7..000000000 --- a/libpthread/nptl/DESIGN-barrier.txt +++ /dev/null @@ -1,44 +0,0 @@ -Barriers pseudocode -=================== - - int pthread_barrier_wait(barrier_t *barrier); - -struct barrier_t { - - unsigned int lock: - - internal mutex - - unsigned int left; - - current barrier count, # of threads still needed. - - unsigned int init_count; - - number of threads needed for the barrier to continue. - - unsigned int curr_event; - - generation count -} - -pthread_barrier_wait(barrier_t *barrier) -{ - unsigned int event; - result = 0; - - lll_lock(barrier->lock); - if (!--barrier->left) { - barrier->curr_event++; - futex_wake(&barrier->curr_event, INT_MAX) - - result = BARRIER_SERIAL_THREAD; - } else { - event = barrier->curr_event; - lll_unlock(barrier->lock); - do { - futex_wait(&barrier->curr_event, event) - } while (event == barrier->curr_event); - } - - if (atomic_increment_val (barrier->left) == barrier->init_count) - lll_unlock(barrier->lock); - - return result; -} diff --git a/libpthread/nptl/DESIGN-condvar.txt b/libpthread/nptl/DESIGN-condvar.txt deleted file mode 100644 index 4845251c7..000000000 --- a/libpthread/nptl/DESIGN-condvar.txt +++ /dev/null @@ -1,134 +0,0 @@ -Conditional Variable pseudocode. -================================ - - int pthread_cond_timedwait (pthread_cond_t *cv, pthread_mutex_t *mutex); - int pthread_cond_signal (pthread_cond_t *cv); - int pthread_cond_broadcast (pthread_cond_t *cv); - -struct pthread_cond_t { - - unsigned int cond_lock; - - internal mutex - - uint64_t total_seq; - - Total number of threads using the conditional variable. - - uint64_t wakeup_seq; - - sequence number for next wakeup. - - uint64_t woken_seq; - - sequence number of last woken thread. - - uint32_t broadcast_seq; - -} - - -struct cv_data { - - pthread_cond_t *cv; - - uint32_t bc_seq - -} - - - -cleanup_handler(cv_data) -{ - cv = cv_data->cv; - lll_lock(cv->lock); - - if (cv_data->bc_seq == cv->broadcast_seq) { - ++cv->wakeup_seq; - ++cv->woken_seq; - } - - /* make sure no signal gets lost. */ - FUTEX_WAKE(cv->wakeup_seq, ALL); - - lll_unlock(cv->lock); -} - - -cond_timedwait(cv, mutex, timeout): -{ - lll_lock(cv->lock); - mutex_unlock(mutex); - - cleanup_push - - ++cv->total_seq; - val = seq = cv->wakeup_seq; - cv_data.bc = cv->broadcast_seq; - cv_data.cv = cv; - - while (1) { - - lll_unlock(cv->lock); - - enable_async(&cv_data); - - ret = FUTEX_WAIT(cv->wakeup_seq, val, timeout); - - restore_async - - lll_lock(cv->lock); - - if (bc != cv->broadcast_seq) - goto bc_out; - - val = cv->wakeup_seq; - - if (val != seq && cv->woken_seq != val) { - ret = 0; - break; - } - - if (ret == TIMEDOUT) { - ++cv->wakeup_seq; - break; - } - } - - ++cv->woken_seq; - - bc_out: - lll_unlock(cv->lock); - - cleanup_pop - - mutex_lock(mutex); - - return ret; -} - -cond_signal(cv) -{ - lll_lock(cv->lock); - - if (cv->total_seq > cv->wakeup_seq) { - ++cv->wakeup_seq; - FUTEX_WAKE(cv->wakeup_seq, 1); - } - - lll_unlock(cv->lock); -} - -cond_broadcast(cv) -{ - lll_lock(cv->lock); - - if (cv->total_seq > cv->wakeup_seq) { - cv->wakeup_seq = cv->total_seq; - cv->woken_seq = cv->total_seq; - ++cv->broadcast_seq; - FUTEX_WAKE(cv->wakeup_seq, ALL); - } - - lll_unlock(cv->lock); -} diff --git a/libpthread/nptl/DESIGN-rwlock.txt b/libpthread/nptl/DESIGN-rwlock.txt deleted file mode 100644 index 810d1b8f3..000000000 --- a/libpthread/nptl/DESIGN-rwlock.txt +++ /dev/null @@ -1,113 +0,0 @@ -Reader Writer Locks pseudocode -============================== - - pthread_rwlock_rdlock(pthread_rwlock_t *rwlock); - pthread_rwlock_unlock(pthread_rwlock_t *rwlock); - pthread_rwlock_wrlock(pthread_rwlock_t *rwlock); - -struct pthread_rwlock_t { - - unsigned int lock: - - internal mutex - - unsigned int writers_preferred; - - locking mode: 0 recursive, readers preferred - 1 nonrecursive, writers preferred - - unsigned int readers; - - number of read-only references various threads have - - pthread_t writer; - - descriptor of the writer or 0 - - unsigned int readers_wakeup; - - 'all readers should wake up' futex. - - unsigned int writer_wakeup; - - 'one writer should wake up' futex. - - unsigned int nr_readers_queued; - - number of readers queued up. - - unsigned int nr_writers_queued; - - number of writers queued up. -} - -pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) -{ - lll_lock(rwlock->lock); - for (;;) { - if (!rwlock->writer && (!rwlock->nr_writers_queued || - !rwlock->writers_preferred)) - break; - - rwlock->nr_readers_queued++; - val = rwlock->readers_wakeup; - lll_unlock(rwlock->lock); - - futex_wait(&rwlock->readers_wakeup, val) - - lll_lock(rwlock->lock); - rwlock->nr_readers_queued--; - } - rwlock->readers++; - lll_unlock(rwlock->lock); -} - -pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) -{ - int result = EBUSY; - lll_lock(rwlock->lock); - if (!rwlock->writer && (!rwlock->nr_writers_queued || - !rwlock->writers_preferred)) - rwlock->readers++; - lll_unlock(rwlock->lock); - return result; -} - -pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) -{ - lll_lock(rwlock->lock); - for (;;) { - if (!rwlock->writer && !rwlock->readers) - break; - - rwlock->nr_writers_queued++; - val = rwlock->writer_wakeup; - lll_unlock(rwlock->lock); - - futex_wait(&rwlock->writer_wakeup, val); - - lll_lock(rwlock->lock); - rwlock->nr_writers_queued--; - } - rwlock->writer = pthread_self(); - lll_unlock(rwlock->lock); -} - -pthread_rwlock_unlock(pthread_rwlock_t *rwlock) -{ - lll_lock(rwlock->lock); - - if (rwlock->writer) - rwlock->writer = 0; - else - rwlock->readers--; - - if (!rwlock->readers) { - if (rwlock->nr_writers_queued) { - ++rwlock->writer_wakeup; - lll_unlock(rwlock->lock); - futex_wake(&rwlock->writer_wakeup, 1); - return; - } else - if (rwlock->nr_readers_queued) { - ++rwlock->readers_wakeup; - lll_unlock(rwlock->lock); - futex_wake(&rwlock->readers_wakeup, MAX_INT); - return; - } - } - - lll_unlock(rwlock->lock); -} diff --git a/libpthread/nptl/DESIGN-sem.txt b/libpthread/nptl/DESIGN-sem.txt deleted file mode 100644 index 17eb0c11c..000000000 --- a/libpthread/nptl/DESIGN-sem.txt +++ /dev/null @@ -1,46 +0,0 @@ -Semaphores pseudocode -============================== - - int sem_wait(sem_t * sem); - int sem_trywait(sem_t * sem); - int sem_post(sem_t * sem); - int sem_getvalue(sem_t * sem, int * sval); - -struct sem_t { - - unsigned int count; - - current semaphore count, also used as a futex -} - -sem_wait(sem_t *sem) -{ - for (;;) { - - if (atomic_decrement_if_positive(sem->count)) - break; - - futex_wait(&sem->count, 0) - } -} - -sem_post(sem_t *sem) -{ - n = atomic_increment(sem->count); - // Pass the new value of sem->count - futex_wake(&sem->count, n + 1); -} - -sem_trywait(sem_t *sem) -{ - if (atomic_decrement_if_positive(sem->count)) { - return 0; - } else { - return EAGAIN; - } -} - -sem_getvalue(sem_t *sem, int *sval) -{ - *sval = sem->count; - read_barrier(); -} diff --git a/libpthread/nptl/TODO b/libpthread/nptl/TODO deleted file mode 100644 index a4a1055f4..000000000 --- a/libpthread/nptl/TODO +++ /dev/null @@ -1,12 +0,0 @@ -- we should probably extend pthread_mutexattr_t with a field to create a - single linked list of all instances. This requires changing the - pthread_mutexattr_* functions. - - -- a new attribute for mutexes: number of times we spin before calling -sys_futex - - - -- test with threaded process terminating and semadj (?) being applied - only after all threads are gone diff --git a/libpthread/nptl/TODO-kernel b/libpthread/nptl/TODO-kernel deleted file mode 100644 index ad6d2a4b5..000000000 --- a/libpthread/nptl/TODO-kernel +++ /dev/null @@ -1,20 +0,0 @@ -- setuid/setgid must effect process - + test syscalls (getuid) afterwards - + test core file content - - + use UID/GID in access(2), chmod(2), chown(2), link(2) - -- nice level is process property - -- rlimit should be process-wide and SIGXCPU should be sent if all threads - together exceed the limit - -- getrusage() must return resource utilization for the process - - - -The following are possible optimizations and in no way required: - - -- the scheduler should be thread group-aware, i.e., it has to give time to - the thread group not proportional to the number of threads. diff --git a/libpthread/nptl/TODO-testing b/libpthread/nptl/TODO-testing deleted file mode 100644 index e076e5624..000000000 --- a/libpthread/nptl/TODO-testing +++ /dev/null @@ -1,20 +0,0 @@ -pthread_attr_setguardsize - - test effectiveness - -pthread_attr_[sg]etschedparam - - what to test? - -pthread_attr_[sg]etstack - - some more tests needed - -pthread_getcpuclockid - - check that value is reset -> rt subdir - -pthread_getschedparam -pthread_setschedparam - - what to test? diff --git a/libpthread/nptl/pt-allocrtsig.c b/libpthread/nptl/pt-allocrtsig.c deleted file mode 100644 index e33775d5a..000000000 --- a/libpthread/nptl/pt-allocrtsig.c +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright (C) 2002, 2004 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> - - -/* These are defined in libc. We want to have only one definition - so we "forward" the calls. */ -extern int __libc_current_sigrtmin (void); -extern int __libc_current_sigrtmax (void); -extern int __libc_allocate_rtsig (int high); - - -/* We reserve __SIGRTMIN for use as the cancellation signal and - __SIGRTMIN+1 to handle setuid et.al. These signals are used - internally. */ -int -__libc_current_sigrtmin (void) -{ - return __libc_current_sigrtmin (); -} - - -int -__libc_current_sigrtmax (void) -{ - return __libc_current_sigrtmax (); -} - - -int -__libc_allocate_rtsig (int high) -{ - return __libc_allocate_rtsig (high); -} diff --git a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c b/libpthread/nptl/sysdeps/pthread/pt-longjmp.c deleted file mode 100644 index f161380ea..000000000 --- a/libpthread/nptl/sysdeps/pthread/pt-longjmp.c +++ /dev/null @@ -1,29 +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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <setjmp.h> -#include <stdlib.h> -#include "pthreadP.h" - -void -longjmp (jmp_buf env, int val) -{ - __libc_longjmp (env, val); -} -weak_alias (longjmp, siglongjmp) diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/aio_misc.h b/libpthread/nptl/sysdeps/unix/sysv/linux/aio_misc.h deleted file mode 100644 index 7b0bac75f..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/aio_misc.h +++ /dev/null @@ -1,67 +0,0 @@ -/* Copyright (C) 2004 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Jakub Jelinek <jakub@redhat.com>, 2004. - - 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; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#ifndef _AIO_MISC_H -# include_next <aio_misc.h> -# include <signal.h> -# include <sysdep.h> -# include <pthread.h> - -# define aio_start_notify_thread __aio_start_notify_thread -# define aio_create_helper_thread __aio_create_helper_thread - -extern inline void -__aio_start_notify_thread (void) -{ - sigset_t ss; - sigemptyset (&ss); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, NULL, _NSIG / 8); -} - -extern inline int -__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg) -{ - pthread_attr_t attr; - - /* Make sure the thread is created detached. */ - pthread_attr_init (&attr); - pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED); - - /* The helper thread needs only very little resources. */ - (void) pthread_attr_setstacksize (&attr, PTHREAD_STACK_MIN); - - /* Block all signals in the helper thread. To do this thoroughly we - temporarily have to block all signals here. */ - sigset_t ss; - sigset_t oss; - sigfillset (&ss); - INTERNAL_SYSCALL_DECL (err); - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &ss, &oss, _NSIG / 8); - - int ret = pthread_create (threadp, &attr, tf, arg); - - /* Restore the signal mask. */ - INTERNAL_SYSCALL (rt_sigprocmask, err, 4, SIG_SETMASK, &oss, NULL, - _NSIG / 8); - - (void) pthread_attr_destroy (&attr); - return ret; -} -#endif diff --git a/libpthread/nptl/sysdeps/unix/sysv/linux/allocrtsig.c b/libpthread/nptl/sysdeps/unix/sysv/linux/allocrtsig.c deleted file mode 100644 index b37d54d65..000000000 --- a/libpthread/nptl/sysdeps/unix/sysv/linux/allocrtsig.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright (C) 2002, 2003, 2004 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, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. */ - -#include <signal.h> - - -static int current_rtmin = __SIGRTMIN + 2; -static int current_rtmax = __SIGRTMAX; - - -/* We reserve __SIGRTMIN for use as the cancelation signal. This - signal is used internally. */ -int -__libc_current_sigrtmin (void) -{ - return current_rtmin; -} -libc_hidden_def (__libc_current_sigrtmin) -strong_alias (__libc_current_sigrtmin, __libc_current_sigrtmin_private) - - -int -__libc_current_sigrtmax (void) -{ - return current_rtmax; -} -libc_hidden_def (__libc_current_sigrtmax) -strong_alias (__libc_current_sigrtmax, __libc_current_sigrtmax_private) - - -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--; -} -strong_alias (__libc_allocate_rtsig, __libc_allocate_rtsig_private) |
