summaryrefslogtreecommitdiff
path: root/sysdeps
AgeCommit message (Collapse)Author
2012-08-30Merge commit 'refs/top-bases/t/fix_have_kernel_resources' into ↵t/fix_have_kernel_resourcesThomas Schwinge
t/fix_have_kernel_resources
2012-08-07Rename ia32 sysdep directories to i386.Thomas Schwinge
* sysdeps/i386/Implies: Remove file. * sysdeps/mach/hurd/i386/Implies: Likewise. * sysdeps/ia32/bits/memory.h: Rename to sysdeps/i386/bits/memory.h. * sysdeps/ia32/bits/pt-atomic.h: Rename to sysdeps/i386/bits/pt-atomic.h. * sysdeps/ia32/bits/spin-lock-inline.h: Rename to sysdeps/i386/bits/spin-lock-inline.h. * sysdeps/ia32/bits/spin-lock.h: Rename to sysdeps/i386/bits/spin-lock.h. * sysdeps/ia32/machine-sp.h: Rename to sysdeps/i386/machine-sp.h. * sysdeps/ia32/pt-machdep.h: Rename to sysdeps/i386/pt-machdep.h. * sysdeps/mach/hurd/ia32/pt-machdep.c: Rename to sysdeps/mach/hurd/i386/pt-machdep.c. * sysdeps/mach/hurd/ia32/pt-setup.c: Rename to sysdeps/mach/hurd/i386/pt-setup.c. * Makefile (SYSDEP_PATH): Adapt to that.
2012-08-07Remove PowerPC port.Thomas Schwinge
* sysdeps/powerpc/bits/machine-lock.h: Remove file. * sysdeps/powerpc/bits/memory.h: Likewise. * sysdeps/powerpc/bits/spin-lock.h: Likewise. * sysdeps/powerpc/machine-sp.h: Likewise. * sysdeps/powerpc/pt-machdep.h: Likewise. * TODO: Update.
2012-08-07Remove L4 port.Thomas Schwinge
* Makefile.am: Remove file. * headers.m4: Likewise. * sysdeps/l4/bits/pthread-np.h: Likewise. * sysdeps/l4/hurd/bits/pthread-np.h: Likewise. * sysdeps/l4/hurd/ia32/pt-machdep.c: Likewise. * sysdeps/l4/hurd/ia32/pt-setup.c: Likewise. * sysdeps/l4/hurd/ia32/signal-dispatch-lowlevel.c: Likewise. * sysdeps/l4/hurd/powerpc/pt-machdep.c: Likewise. * sysdeps/l4/hurd/powerpc/pt-setup.c: Likewise. * sysdeps/l4/hurd/pt-block.c: Likewise. * sysdeps/l4/hurd/pt-kill.c: Likewise. * sysdeps/l4/hurd/pt-setactivity-np.c: Likewise. * sysdeps/l4/hurd/pt-sigstate-destroy.c: Likewise. * sysdeps/l4/hurd/pt-sigstate-init.c: Likewise. * sysdeps/l4/hurd/pt-sigstate.c: Likewise. * sysdeps/l4/hurd/pt-startup.c: Likewise. * sysdeps/l4/hurd/pt-sysdep.c: Likewise. * sysdeps/l4/hurd/pt-sysdep.h: Likewise. * sysdeps/l4/hurd/pt-thread-alloc.c: Likewise. * sysdeps/l4/hurd/pt-thread-halt.c: Likewise. * sysdeps/l4/hurd/pt-thread-start.c: Likewise. * sysdeps/l4/hurd/pt-wakeup.c: Likewise. * sysdeps/l4/hurd/sig-sysdep.h: Likewise. * sysdeps/l4/hurd/sigprocmask.c: Likewise. * sysdeps/l4/pt-block.c: Likewise. * sysdeps/l4/pt-docancel.c: Likewise. * sysdeps/l4/pt-pool-np.c: Likewise. * sysdeps/l4/pt-spin.c: Likewise. * sysdeps/l4/pt-stack-alloc.c: Likewise. * sysdeps/l4/pt-thread-alloc.c: Likewise. * sysdeps/l4/pt-thread-dealloc.c: Likewise. * sysdeps/l4/pt-thread-halt.c: Likewise. * sysdeps/l4/pt-thread-start.c: Likewise. * sysdeps/l4/pt-timedblock.c: Likewise. * sysdeps/l4/pt-wakeup.c: Likewise. * TODO: Update. * signal/README: Likewise.
2012-07-08Default to a little guardsizeSamuel Thibault
Later rounded up to a page. * sysdeps/generic/pt-attr.c (__pthread_default_attr) [!PAGESIZE]: Set guardsize field to 1.
2012-04-27Store self in __thread variable instead of threadvarSamuel Thibault
* sysdeps/mach/hurd/pt-sysdep.h (_HURD_THREADVAR_THREAD): Remove macro. (___pthread_self): Declare new __thread variable. (_pthread_self): Take self pointer from ___pthread_self instead of threadvar. * sysdeps/mach/hurd/pt-sysdep.c (___pthread_self): Define new __thread variable. (init_routine): Set ___pthread_self to initial thread structure. * pthread/pt-internal.h (__pthread_setup): Add `self' parameter to `entry_point' parameter. * pthread/pt-create.c (entry_point): Add `self' parameter. Store it in ___pthread_self. * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Add `self parameter to `entry_point' parameter. Pass it the `thread' parameter. (__pthread_setup): Likewise. * sysdeps/l4/hurd/powerpc/pt-setup.c (struct start_info): Add `self' field. (first_entry_1): Pass `self' parameter. (stack_setup): Add `self' parameter to `entry_point' parameter, pass it the `thread' parameter. (__pthread_setup): Likewise. * sysdeps/mach/hurd/ia32/pt-setup.c (stack_setup): Pass `thread' parameter to the start routine. (stack_setup): Add `self' parameter to `entry_point' paramter.
2012-04-23Rename __pthread_initialize into __pthread_initSamuel Thibault
The former conflicts with usage in glibc. * pthread/pt-initialize.c (__pthread_initialize): Rename into __pthread_init. * pthread/pt-internal.h (__pthread_initialize): Likewise. * sysdeps/l4/hurd/pt-sysdep.c (init_routine): Likewise. * sysdeps/mach/hurd/pt-sysdep.c (init_routine): Likewise.
2012-04-22Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/libpthreadSamuel Thibault
2012-04-22Install bits/pthreadtypes.hSamuel Thibault
And make it expose only types, not the rest of the pthread API. * Makefile (headers): Add bits/pthreadtypes.h. * sysdeps/generic/bits/pthreadtypes.h: Include <pthread/pthreadtypes.h> instead of <pthread.h>
2012-04-22pthread_condattr_setclock: allow a monotonic clock, if presentPino Toscano
If CLOCK_MONOTONIC is requested, check (only once) for the availability of a monotonic clock using `clock_getres'. If it is not, reject CLOCK_MONOTONIC with EINVAL (as before). * sysdeps/generic/pt-condattr-setclock.c (pthread_condattr_setclock): Check for monotonic clock if requested.
2012-04-22__pthread_timedblock: switch to clock_gettimePino Toscano
Use `clock_gettime' with the provided clock instead of `gettimeofday', linking to rt. * sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Switch to `clock_gettime'. * Makefile [!IN_GLIBC] (LDLIBS): Link to rt. [IN_GLIBC] ($(objpfx)libpthread.so): Likewise. * Makefile.am (libpthread_a_LDADD): Likewise.
2012-04-22__pthread_timedblock: add an argument for the clock idPino Toscano
To make `__pthread_timedblock' properly measure time using the right clock, add a new argument representing the clock to use. * pthread/pt-internal.h (__pthread_timedblock): New argument CLOCK_ID. * sysdeps/l4/pt-timedblock.c (__pthread_timedblock): Likewise. * sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Likewise. * sysdeps/generic/pt-cond-timedwait.c (__pthread_cond_timedwait_internal): Pass the clock of the `pthread_cond' to `__pthread_timedblock'. * sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal): Pass CLOCK_REALTIME to `__pthread_timedblock'. * sysdeps/generic/pt-rwlock-timedrdlock.c (__pthread_rwlock_timedrdlock_internal): Likewise. * sysdeps/generic/pt-rwlock-timedwrlock.c (__pthread_rwlock_timedwrlock_internal): Likewise. * sysdeps/generic/sem-timedwait.c (__sem_timedwait_internal): Likewise.
2012-04-21Add glibc build supportSamuel Thibault
* Makeconfig, Versions, configure.in, forward.c, libc_pthread_init.c, pthread/pthread-functions.h, shlib-versions, sysdeps/i386/Implies, sysdeps/mach/hurd/Implies, sysdeps/mach/hurd/i386/Implies: New files. * Makefile: Add glibc rules, enabled when IN_GLIBC is defined to yes, when $(..) is defined. * pthread/pt-initialize.c [IS_IN_libpthread] (pthread_functions): New variable. [IS_IN_libpthread] (__pthread_initialize): Call __libc_pthread_init.
2012-04-21Rename bits/atomic.h to bits/pt-atomic.hSamuel Thibault
This avoids a conflict with glibc-provided bits/atomic.h * sysdeps/ia32/bits/atomic.h: Rename to... * sysdeps/ia32/bits/pt-atomic.h: ... this. * pthread/pt-create.c: Include <bits/pt-atomic.h> instead of <bits/atomic.h> * pthread/pt-exit.c: Likewise. * pthread/pt-internal.h: Likewise.
2012-04-21Rename pthread functions to be used for forwardingSamuel Thibault
Libc will need to be able to call them, so they need to have a different name. * pthread/pt-exit.c (pthread_exit): Rename with __ prefix and add strong alias. * pthread/pt-self.c (pthread_self): Likewise. * pthread/pt-setcancelstate.c (pthread_setcancelstate): Likewise * pthread/pt-setcanceltype.c (pthread_setcanceltype): Likewise * sysdeps/generic/pt-attr-destroy.c (pthread_attr_destroy): Likewise * sysdeps/generic/pt-attr-getdetachstate.c (pthread_attr_getdetachstate): Likewise * sysdeps/generic/pt-attr-getinheritsched.c (pthread_attr_getinheritsched): Likewise * sysdeps/generic/pt-attr-getschedparam.c (pthread_attr_getschedparam): Likewise * sysdeps/generic/pt-attr-getschedpolicy.c (pthread_attr_getschedpolicy): Likewise * sysdeps/generic/pt-attr-getscope.c (pthread_attr_getscope): Likewise * sysdeps/generic/pt-attr-init.c (pthread_attr_init): Likewise * sysdeps/generic/pt-attr-setdetachstate.c (pthread_attr_setdetachstate): Likewise * sysdeps/generic/pt-attr-setinheritsched.c (pthread_attr_setinheritsched): Likewise * sysdeps/generic/pt-attr-setschedparam.c (pthread_attr_setschedparam): Likewise * sysdeps/generic/pt-attr-setschedpolicy.c (pthread_attr_setschedpolicy): Likewise * sysdeps/generic/pt-attr-setscope.c (pthread_attr_setscope): Likewise * sysdeps/generic/pt-cond-brdcast.c (pthread_cond_broadcast): Likewise * sysdeps/generic/pt-cond-destroy.c (pthread_cond_destroy): Likewise * sysdeps/generic/pt-cond-init.c (pthread_cond_init): Likewise * sysdeps/generic/pt-cond-signal.c (pthread_cond_signal): Likewise * sysdeps/generic/pt-cond-timedwait.c (pthread_cond_timedwait): Likewise * sysdeps/generic/pt-cond-wait.c (pthread_cond_wait): Likewise * sysdeps/generic/pt-condattr-destroy.c (pthread_condattr_destroy): Likewise * sysdeps/generic/pt-condattr-init.c (pthread_condattr_init): Likewise * sysdeps/generic/pt-equal.c (pthread_equal): Likewise * sysdeps/generic/pt-getschedparam.c (pthread_getschedparam): Likewise * sysdeps/generic/pt-setschedparam.c (pthread_setschedparam): Likewise
2011-11-06Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/libpthreadSamuel Thibault
2011-11-06pthread_getspecific, pthread_setspecific: check the key validityPino Toscano
When getting a TSD, handle gracefully the case of an invalid key. When setting a TSD, check for the validity of the key as recommended (although not required) by POSIX. This also avoids potentially filling the `thread_specifics' hash of threads with TSD of invalid keys. Add two simple checks in test-7.c for the two situations above. * sysdeps/hurd/pt-getspecific.c (pthread_getspecific): Check the validity of the specified key. * sysdeps/hurd/pt-setspecific.c (pthread_setspecific): Likewise. * tests/test-7.c (main): Add two assertions.
2011-11-06Merge branch '__pthread_destroy_specific-PTHREAD_KEY_INVALID'Thomas Schwinge
Conflicts: tests/Makefile
2011-11-05Correct logic for PTHREAD_KEY_INVALID slots.Thomas Schwinge
* sysdeps/hurd/pt-destroy-specific.c (__pthread_destroy_specific): Correct logic for PTHREAD_KEY_INVALID slots. * tests/test-__pthread_destroy_specific-skip.c: New file. * tests/Makefile (CHECK_SRC): Add test-__pthread_destroy_specific-skip.c.
2011-11-05Remove all the values when deleting a keyPino Toscano
When deleting a key using `pthread_key_delete', delete all the values associated to that key in all the threads available. Otherwise, the key reuse in `pthread_key_create' can cause new keys to have thread specific data of the previously used key with the same index. Add a test for this case, which creates and deletes pairs of keys checking that they have a NULL thread specific data after creation. * sysdeps/hurd/pt-key-delete.c (pthread_key_delete): Remove all the values of the key in all the threads. * tests/Makefile (CHECK_SRC): Add test-17.c. * tests/test-17.c: New file.
2011-10-20Merge commit 'refs/top-bases/t/fix_have_kernel_resources' into ↵Thomas Schwinge
t/fix_have_kernel_resources
2011-10-20Merge branch 'tls'Thomas Schwinge
Conflicts: ChangeLog Makefile pthread/pt-exit.c pthread/pt-internal.h sysdeps/mach/hurd/ia32/pt-setup.c sysdeps/mach/hurd/pt-docancel.c sysdeps/mach/hurd/pt-sysdep.h
2011-10-20 TLS support for libpthread, Mach/Hurd (x86).Samuel Thibault
* Makefile (CFLAGS): Define ENABLE_TLS. * pthread/pt-create.c (__pthread_create_internal) [ENABLE_TLS]: Call into glibc to allocate static TLS block. * pthread/pt-exit.c (pthread_exit) [ENABLE_TLS]: Call into glibc to deallocate static TLS block. * pthread/pt-internal.h [ENABLE_TLS] (tcbhead_t): New structure; as in glibc. (__pthread) [ENABLE_TLS]: Add TCB member. [ENABLE_TLS] (_dl_allocate_tls, _dl_deallocate_tls): Declare; from glibc. * sysdeps/mach/hurd/pt-sysdep.h (__thread_set_pcsp): Rename to __thread_set_pcsptp. Add SET_TP and TP parameters. Change all callers. * sysdeps/mach/hurd/i386/pt-machdep.c (__thread_set_pcsptp): Imlement TLS support. * sysdeps/mach/hurd/i386/pt-setup.c (__pthread_setup): Likewise.
2011-09-07Merge commit 'refs/top-bases/t/fix_have_kernel_resources' into ↵Thomas Schwinge
t/fix_have_kernel_resources
2011-09-07Tiny build and GCC warning fixes.Thomas Schwinge
* pthread/cthreads-compat.c: #include <stddef.h> for NULL. * pthread/pt-exit.c (pthread_exit): Remove stray need_dealloc variable. * sysdeps/generic/pt-attr-getschedparam.c: #include <string.h> for memcpy. * sysdeps/mach/hurd/ia32/pt-setup.c (stack_setup): Apply some more typecasting. * tests/test-1.c: #include <assert.h>. * tests/test-6.c: Likewise. * tests/test-7.c: Likewise. * tests/test-16.c (handler): Take parameters for sa_handler, not sa_sigaction.
2011-09-07Merge commit 'refs/top-bases/t/fix_have_kernel_resources' into ↵Thomas Schwinge
t/fix_have_kernel_resources
2011-08-23Use __clockid_t instead of clockid_tSamuel Thibault
Using clockid_t just for pthread types makes us pull <time.h>, which defines time(), which may conflict with applications. * include/pthread/pthread.h (pthread_condattr_getclock, pthread_condattr_setclock, pthread_getcpuclockid): Use __clockid_t instead of clockid_t. * include/pthread/pthreadtypes.h: Include <bits/types.h>, instead of <time.h> and defining clockid_t ourself when not defined by time.h. * sysdeps/generic/bits/condition-attr.h: Include <bits/types.h> instead of <time.h>. (__pthread_condattr): Use __clockid_t instead of clockid_t.
2010-09-03Fix __sched_param / sched_param conversionSamuel Thibault
* sysdeps/generic/pt-attr-getschedparam.c (pthread_attr_getschedparam): memcpy from `attr->schedparam' to `param' to convert from __sched_param to sched_param. * sysdeps/generic/pt-attr-setschedparam.c (pthread_attr_setschedparam): memcpy from `param' to `attr->schedparam' to convert from sched_param to __sched_param.
2010-09-02Use __sched_param instead of sched_paramSamuel Thibault
to avoid exposing inclusion of <sched.h> and exposure of sched_param from <sys/types.h> * sysdeps/generic/bits/thread-attr.h: Define __need_schedparam and include <bits/sched.h> instead of including <sched.h> (__pthread_attr): Use `__sched_param' instead of `sched_param'.
2010-09-01Prevent pthread.h from exposing assert()Samuel Thibault
* sysdeps/generic/bits/cancelation.h: Do not include <assert.h> (__pthread_cleanup_pop): Do not call `assert'.
2010-04-12Merge remote branch 'remotes/savannah/master-fix_have_kernel_resources' into ↵Thomas Schwinge
t/fix_have_kernel_resources
2009-10-18Fix pthread_kill(thread, 0)Samuel Thibault
* sysdeps/hurd/pt-kill.c (pthread_kill): Return immediately after checks without calling _hurd_raise_signal if sig is 0.
2009-10-13Fix pthread_cleanup_push old-gcc-style initializerSamuel Thibault
sysdeps/generic/bits/cancelation.h (__pthread_cleanup_push): For better portability to various compilation flags, use standard initializer for struct __pthread_cancelation_handler __handler instead of old-gcc-style.
2009-08-23Fix pthread_mutex_t static initializersSamuel Thibault
Fix pthread_mutex_t static initializers by not leaving references to __pthread_recursive_mutexattr. * include/pthread/pthread.h.orig (PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP): New macro. * sysdeps/generic/pt-mutex-destroy.c (_pthread_mutex_destroy): Compare mutex->attr with __PTHREAD_ERRORCHECK_MUTEXATTR and __PTHREAD_RECURSIVE_MUTEXATTR instead of __pthread_recursive_mutexattr. * sysdeps/generic/pt-mutex-init.c (_pthread_mutex_init): Likewise. * sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal): Likewise. * sysdeps/generic/pt-mutex-transfer-np.c (__pthread_mutex_transfer_np): Likewise. * sysdeps/generic/pt-mutex-trylock.c (__pthread_mutex_trylock): Likewise. * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): Likewise. * sysdeps/generic/pt-mutexattr.c (__pthread_errorcheck_mutexattr): New const. * sysdeps/generic/bits/mutex-attr.h (__pthread_errorcheck_mutexattr): Declare const. * sysdeps/generic/bits/mutex.h (__PTHREAD_ERRORCHECK_MUTEXATTR, __PTHREAD_ERRORCHECK_MUTEX_INITIALIZER, __PTHREAD_RECURSIVE_MUTEXATTR): New macros. (__PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Use __PTHREAD_RECURSIVE_MUTEXATTR macro instead of &__pthread_recursive_mutexattr.
2009-08-23Fix assertion failure in pthread_mutex_trylockSamuel Thibault
* sysdeps/generic/pt-mutex-trylock.c [!ALWAYS_TRACK_MUTEX_OWNER] (__pthread_mutex_trylock): Disable owner tracking.
2009-06-22[UNFINISHED] Fix handling of have_kernel_resources on Mach/Hurd.Thomas Schwinge
<http://lists.gnu.org/archive/html/bug-hurd/2009-04/msg00028.html> Further comments by Neal: <neal> do you want a reply on the libpthread one inline? <neal> the short answer is: yes, that's a bug <neal> unfortunately, your fix is not enough <neal> the predicate controls two resources: the wakeup port and the thread itself <tschwinge> Oh, right, I see. <neal> also, there may be a race: <neal> set the predicate to free, then kill the thread <neal> that's not so good <neal> so a proper solution requires a bit more thought <tschwinge> I think I wondered about that as well. But isn't there the same problem with Viengoos? <neal> it is difficult as cleanly committing suicide is hard :-) <neal> could be <neal> on viengoos, I don't actually deallocate the thread in pt-thread-halt.c <neal> I just call suspend <neal> the thread is only deallocated in pt-thread-dealloc.c
2009-04-082009-01-10 Samuel Thibault <samuel.thibault@ens-lyon.org>Samuel Thibault
* sysdeps/i386/bits/spin-lock.h (__SPIN_LOCK_INITIALIZER): Rename macro to... (__PTHREAD_SPIN_LOCK_INITIALIZER): ... this. * sysdeps/mach/bits/spin-lock.h (__SPIN_LOCK_INITIALIZER): Rename macro to... (__PTHREAD_SPIN_LOCK_INITIALIZER): ... this. * include/pthread/pthread.h (PTHREAD_SPINLOCK_INITIALIZER): Use __PTHREAD_SPIN_LOCK_INITIALIZER instead of __SPIN_LOCK_INITIALIZER. * sysdeps/generic/bits/condition.h (__PTHREAD_COND_INITIALIZER): Likewise. * sysdeps/generic/bits/mutex.h (__PTHREAD_MUTEX_INITIALIZER, __PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Likewise. * sysdeps/generic/bits/once.h (__PTHREAD_ONCE_INIT): Likewise. * sysdeps/generic/bits/rwlock.h (__PTHREAD_RWLOCK_INITIALIZER): Likewise. * sysdeps/generic/bits/semaphore.h (__SEMAPHORE_INITIALIZER): Likewise. * sysdeps/i386/bits/spin-lock-inline.h (__pthread_spin_init): Likewise. * sysdeps/i386/mach/spin-lock-inline.h (__pthread_spin_init): Likewise.
2009-04-082008-12-21 Samuel Thibault <samuel.thibault@ens-lyon.org>Samuel Thibault
* sysdeps/mach/pt-timedblock.c (__pthread_timedblock): Fix timeout computation from abstime and now.
2009-04-082008-10-02 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal) [! ALWAYS_TRACK_MUTEX_OWNER]: Don't update MUTEX->OWNER or assert MUTEX->OWNER for normal mutexes. * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock) [! ALWAYS_TRACK_MUTEX_OWNER]: Don't update MUTEX->OWNER or assert MUTEX->OWNER for normal mutexes. * sysdeps/generic/pt-mutex-transfer-np.c (__pthread_mutex_transfer_np) [! ALWAYS_TRACK_MUTEX_OWNER]: Don't update MUTEX->OWNER for normal mutexes.
2009-04-082008-08-26 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* sysdeps/mach/pt-thread-alloc.c (__pthread_thread_alloc): Set THREAD->HAVE_KERNEL_RESOURCES to 1, not true. Reported by Flávio Cruz <Flávio Cruz>.
2009-04-072008-08-16 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* pthread/pt-alloc.c: Don't include <bits/atomic.h>. (__pthread_free_threads): Change to a struct __pthread *. (__pthread_free_threads_lock): New variable. (__pthread_alloc): When looking for a TCB to reuse, iterate over __pthread_free_threads taking the first for which the STATE field is PTHREAD_TERMINATED. When reusing a TCB, first call __pthread_thread_halt on it. * pthread/pt-dealloc.c: Don't include <bits/atomic.h>. (__pthread_free_threads): Change to a struct __pthread *. (__pthread_free_threads_lock): New declaration. (__pthread_dealloc): Enqueue PTHREAD on __PTHREAD_FREE_THREADS. Set PTHREAD->STATE to PTHREAD_TERMINATED after everything else. * pthread/pt-join.c (pthread_join): Call __pthread_thread_halt before destroying the thread. When destroying the thread, call __pthread_thread_dealloc on it. * pthread/pt-detach.c (pthread_detach): If destroying the thread, call __pthread_thread_halt before deallocating the stack. In this case, also call __pthread_thread_dealloc on the tcb. * pthread/pt-exit.c (pthread_exit): Call __pthread_dealloc only if the thread is detached and then as the last thing we do before calling __pthread_thread_halt. * pthread/pt-internal.h (__pthread_thread_halt): Remove argument NEED_DEALLOC. Update users. * sysdeps/mach/pt-thread-halt.c (__pthread_thread_halt): Remove argument need_dealloc. * sysdeps/mach/hurd/pt-sysdep.h (PTHREAD_SYSDEP_MEMBERS): Add field have_kernel_resources. * sysdeps/mach/hurd/pt-thread-alloc.c (__pthread_thread_alloc): If THREAD->HAVE_KERNEL_RESOURCES is true, just return. After allocating the resources, set THREAD->HAVE_KERNEL_RESOURCES to true.
2009-04-072008-08-12 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
Merge changes from hurd-l4 fork. * Makefile (SRCS): Add pt-startup.c and pt-mutex-transfer-np.c. (sysdeps_headers): Add pthread-np.h. 2008-08-12 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/bits/pthread-np.h: New file. 2008-08-12 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/pt-startup.c: New file. 2008-08-12 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/bits/mutex.h (__PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Define. (__PTHREAD_MUTEX_RECURSIVE_INITIALIZER): Don't define. * include/pthread/pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) [__USE_GNU]: Define. (PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP): Don't define. 2008-08-12 Neal H. Walfield <neal@gnu.org> * include/pthread/pthread.h: Include <sys/cdefs.h>. (__extern_inline): If not defined, define appropriately. 2008-06-01 Neal H. Walfield <neal@gnu.org> * include/pthread/pthread.h (PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP): New definition. * sysdeps/generic/bits/mutex.h (__PTHREAD_MUTEX_RECURSIVE_INITIALIZER): New definition. * sysdeps/generic/bits/mutex-attr.h (__pthread_recursive_mutexattr): New definition. * sysdeps/generic/pt-mutexattr.c (__pthread_recursive_mutexattr): New declaration. * sysdeps/generic/pt-mutex-init.c (_pthread_mutex_init): If ATTR is &__PTHREAD_RECURSIVE_MUTEXATTR, don't allocate a copy, just save in MUTEX->ATTR. * sysdeps/generic/pt-mutex-destroy.c (_pthread_mutex_destroy): If MUTEX->ATTR is &__PTHREAD_RECURSIVE_MUTEXATTR, don't free it. 2008-05-29 Thomas Schwinge <tschwinge@gnu.org> * sysdeps/generic/sem-timedwait.c: Don't include <error.h>. 2008-05-21 Neal H. Walfield <neal@gnu.org> * include/pthread/pthread.h: Include <bits/pthread-np.h>. 2008-03-01 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/pt-mutex-transfer-np.c: New file. * pthread/pt-self.c (pthread_self): Assert that SELF is not NULL. 2007-12-23 Neal H. Walfield <neal@gnu.org> * pthread/pt-join.c (pthread_join): Cast argument to pthread_cleanup_push to avoid warning. 2007-11-23 Neal H. Walfield <neal@gnu.org> * pthread/pt-internal.h (__pthread_startup): Add declaration. * pthread/pt-create.c (entry_point): Call __pthread_startup.
2009-04-072008-08-12 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* sysdeps/generic/bits/pthread-np.h: New file.
2009-04-072006-03-04 Samuel Thibault <samuel.thibault@ens-lyon.org>Neal H. Walfield
* sysdeps/ia32/machine-sp.h (thread_stack_pointer): Optimize esp read.
2009-04-072008-08-12 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* sysdeps/generic/pt-startup.c (__pthread_startup): New file.
2009-04-07libpthread/Neal H. Walfield
2008-08-12 Neal H. Walfield <neal@gnu.org> * sysdeps/generic/bits/mutex.h (__PTHREAD_RECURSIVE_MUTEX_INITIALIZER): Define. (__PTHREAD_MUTEX_RECURSIVE_INITIALIZER): Don't define. * include/pthread/pthread.h (PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) [__USE_GNU]: Define. (PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP): Don't define. libhurd-mm/ 2008-08-12 Neal H. Walfield <neal@gnu.org> * storage.c (storage_low_mutex): Use PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP, not PTHREAD_MUTEX_RECURSIVE_INITIALIZER_NP.
2009-04-072008-08-12 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
Merge in Samuel Thibault's changes from the main line. * Makefile.am (libpthread_a_SOURCES): Add pt-getattr.c. * headers.m4: Link libpthread/include/pthread/pthreadtypes.h to sysroot/include/pthread/pthreadtypes.h and libpthread/sysdeps/${arch}/bits/spin-lock-inline.h. to sysroot/include/bits/spin-lock-inline.h. * include/pthread/pthread.h: Include <sys/cdefs.h>. (__extern_inline): If not defined, define appropriately. 2008-08-04 Samuel Thibault <samuel.thibault@ens-lyon.org> * include/pthread/pthreadtypes.h (__pthread_inheritsched): Remove comma at end of enumeration. 2008-08-03 Samuel Thibault <samuel.thibault@ens-lyon.org> * Makefile (sysdeps_headers): Add spin-lock-inline.h. (SYSDEP_PATH): Move sysdeps/ia32 right after sysdeps/$(MICROKERNEL)/ia32. * include/pthread/pthread.h: Include <bits/spin-lock-inline.h>. * sysdeps/ia32/bits/spin-lock.h: Move inlines to... * sysdeps/ia32/bits/spin-lock-inline.h: ... new file. 2008-08-02 Samuel Thibault <samuel.thibault@ens-lyon.org> * sysdeps/generic/bits/mutex.h: Do not include <errno.h> and <stddef.h> * sysdeps/ia32/bits/memory.h (__memory_barrier): Add memory clobber. * sysdeps/ia32/bits/spin-lock.h (__pthread_spin_trylock, __pthread_spin_unlock): Add memory clobbers. * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Fix reservation of stack room for initial frame. 2008-07-18 Samuel Thibault <samuel.thibault@ens-lyon.org> * Makefile (sysdeps_headers): add pthread/pthreadtypes.h 2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org> * include/pthread/pthread.h: Do not define __need_clockid_t, include <time.h>, and define clockid_t if __clockid_defined is not defined. Include <pthread/pthreadtypes.h> (pthread_equal): New extern inline. (pthread_cleanup_push, pthread_cleanup_pop): New macros. (__pthread_process_shared, __pthread_inheritsched, __pthread_contentionscope, __pthread_detachstate, __pthread_mutex_protocol, __pthread_mutex_type, pthread_attr_t, pthread_mutex_attr_t, pthread_mutex_t, pthread_condattr_t, pthread_cond_t, pthread_spinlock_t, pthread_rwlockattr_t, pthread_rwlock_t, pthread_barrierattr_t, pthread_barrier_t, pthread_key_t, pthread_once_t): Move enums and typedefs to... * include/pthread/pthreadtypes.h: ... new file. * sysdeps/generic/bits/cancelation.h (pthread_cleanup_push): Rename macro to __pthread_cleanup_push. (pthread_cleanup_pop): Rename macro to __pthread_cleanup_pop. * sysdeps/generic/bits/barrier-attr.h (__pthread_process_shared): Forward-declare enum. * sysdeps/generic/bits/condition-attr.h (__pthread_process_shared): Likewise. * sysdeps/generic/bits/mutex-attr.h (__pthread_mutex_protocol, __pthread_process_shared, __pthread_mutex_type): Likewise. * sysdeps/generic/bits/rwlock-attr.h (__pthread_process_shared): Likewise. * sysdeps/generic/bits/thread-attr.h (__pthread_detachstate, __pthread_inheritsched, __pthread_contentionscope): Likewise. * sysdeps/generic/bits/pthread.h (pthread_t): Rename type to __pthread_t. (pthread_equal): Rename to __pthread_equal. 2008-06-27 Samuel Thibault <samuel.thibault@ens-lyon.org> * sysdeps/generic/bits/thread-barrier.h: Remove unused file. 2008-05-17 Samuel Thibault <samuel.thibault@ens-lyon.org> * include/pthread/pthread.h (pthread_getattr_np): New declaration. * pthread/pt-getattr.c: New file. * Makefile (SRCS): Add pt-getattr.c. 2008-03-16 Samuel Thibault <samuel.thibault@ens-lyon.org> * include/libc-symbols.h (HAVE_ASM_PREVIOUS_DIRECTIVE): Define. 2008-02-29 Samuel Thibault <samuel.thibault@ens-lyon.org> * sysdeps/l4/hurd/ia32/pt-setup.c (stack_setup): Align stack on 0x10 for MMX operations. 2008-01-01 Samuel Thibault <samuel.thibault@ens-lyon.org> * include/pthread/pthread.h (pthread_spin_destroy, pthread_spin_init, pthread_spin_lock, pthread_spin_trylock, pthread_spin_unlock): Use __extern_inline macro instead of extern __inline. * sysdeps/ia32/bits/spin-lock.h (__PT_SPIN_INLINE, __pthread_spin_lock): Likewise * sysdeps/generic/bits/pthread.h (pthread_equal): Declare ; only provide inline when __USE_EXTERN_INLINES is defined. Use __extern_inline macro instead of extern __inline. * sysdeps/ia32/bits/memory.h (__memory_barrier): Add static to inline.
2009-04-07viengoos/Neal H. Walfield
2008-06-22 Neal H. Walfield <neal@gnu.org> * thread.h: Include "list.h". (struct thread) [! NDEBUG]: Add field futex_waiter_node. [! NDEBUG]: Instantiate the futex_waiter list class. (futex_waiters) [! NDEBUG]: Declare. * server.c (futex_waiters) [! NDEBUG]: New variable. (server_loop) [! NDEBUG]: If we don't get an RPC for a while, dequeue all thread's enqueued on FUTEX_WAITERS and return EDEADLK. When blocking a thread on a futex, add THREAD to FUTEX_WAITERS. * object.c (object_wait_queue_dequeue) [! NDEBUG]: If THREAD->WAIT_REASON is THREAD_WAIT_FUTEX, unlink THREAD from FUTEX_WAITERS. hurd/ 2008-06-22 Neal H. Walfield <neal@gnu.org> * futex.h [! RM_INTERN]: Include <errno.h>. (futex_wait): On error, set ERRNO and return -1. (futex_timed_wait): Likewise. (futex_wake): Likewise. * mutex.h (ss_mutex_lock): If FUTEX_WAIT returns failure, print some debugging information.
2009-04-072008-06-22 Neal H. Walfield <neal@gnu.org>Neal H. Walfield
* sysdeps/generic/pt-mutex-timedlock.c (__pthread_mutex_timedlock_internal): Don't set MUTEX->OWNER here. * sysdeps/generic/pt-mutex-unlock.c (__pthread_mutex_unlock): Set it here to WAKEUP.
2009-04-07viengoos/Neal H. Walfield
2008-06-05 Neal H. Walfield <neal@gnu.org> * cap-lookup.c: Move from here... * ../libhurd-mm/as-lookup.c: ... to here. * as.c: Move from here... * ../libhurd-mm/as-build.c: ... to here. * as-custom.c: Move from here... * ../libhurd-mm/as-build-custom.c: ... to here. * as.h: Move contents... * ../libhurd-mm/as.h: ... to here... * ../libhurd-mm/as-compute-gbits.h: ... and to here. * bits.h: Move from here... * ../libhurd-mm/bits.h: ... to here. * Makefile.am (viengoos_SOURCES): Remove cap-lookup.c, as.h and as.c. (t_as_SOURCES): Likewise. (t_activity_SOURCES): Likewise. (viengoos_LDADD): Add ../libhurd-mm/libas-kernel.a. (t_as_LDADD): Add ../libhurd-mm/libas-check.a. (t_activity_LDADD): Likewise. (lib_LIBRARIES): Remove libhurd-cap.a. (libhurd_cap_a_CPPFLAGS): Remove variable. (libhurd_cap_a_CFLAGS): Likewise. (libhurd_cap_a_SOURCES): Likewise. * server.c (server_loop): Replace use of object_lookup_rel with as_object_lookup_rel. Replace use of slot_lookup_rel with as_slot_lookup_rel_use. Replace use of cap_lookup_rel with as_cap_lookup_rel. * viengoos.c: Don't include "as.h", include <hurd/as.h>. * t-activity.c: Don't include "as.h", include <hurd/as.h>. (allocate_object): Change return type to struct as_allocate_pt_ret. * t-as.c: Don't include "as.h", include <hurd/as.h>. (allocate_object): Change return type to struct as_allocate_pt_ret. (allocate_page_table): New function. (try): Replace use of as_insert with as_insert_full. Replace use of slot_lookup_rel with as_slot_lookup_rel_use. Replace use of object_lookup_rel with as_object_lookup_rel. (test): Likewise. * t-guard.c: Don't include "as.h", include <hurd/as.h>. Include "../libhurd-mm/as-compute-gbits.h". libhurd-mm/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * as.h: Include <hurd/exceptions.h>. [! RM_INTERN]: Include <hurd/storage.h> and <pthread.h>. (as_lock_ensure_stack) [! RM_INTERN]: New function. (as_lock): New function. (as_lock_readonly): Likewise. (as_unlock): Likewise. (meta_data_activity) [RM_INTERN]: Don't declare. (shadow_root) [RM_INTERN]: Don't declare. (struct as_insert_rt): Rename from this... (struct as_allocate_pt_ret): ... to this. Update users. (as_allocate_page_table_t): New typedef. (as_allocate_page_table): New declaration. (as_build): New declaration. (as_build_custom): Likewise. (as_slot_ensure): Remove declaration. (as_ensure_full): New macro. (as_ensure_use) [! RM_INTERN]: Likewise. (as_ensure) [! RM_INTERN]: New function. (as_insert): Rename from this... (as_insert_full): ... to this. Don't return the capability. Reverse the order of the source address and cap. Replace allocate_object parameter with an allocate_page_table parameter. Update users. (as_insert) [! RM_INTERN]: New function. (as_slot_ensure_full_custom): Rename from this... (as_ensure_full_custom): ... to this. Replace allocate_object parameter with an allocate_page_table parameter. (as_insert_custom): Likewise. (union as_lookup_ret): New definition. (as_lookup_want_cap): New definition. (as_lookup_want_slot): Likewise. (as_lookup_want_object): Likewise. (as_lookup_rel): New declaration. (slot_lookup): Remove declaration. (as_slot_lookup_rel_use): Replace it with this macro. (as_slot_lookup_use) [! RM_INTERN]: New macro. (as_cap_lookup_rel): New function. (cap_lookup): Rename from this... (as_cap_lookup) [! RM_INTERN]: ... to this. Remove activity parameter. Implement here as a static inline function. (as_object_lookup_rel): New function. (object_lookup): Rename from this... (as_object_lookup) [! RM_INTERN]: ... to this. Remove activity parameter. Implement here as a static inline function. (as_dump_from): New declaration. * as-compute-gbits.h: Include <hurd/folio.h>. * as.c (allocate_object): Rename from this... (as_allocate_page_table): ... to this. Remove static qualifier. Don't take parameter type, just allocate a cap_cappage. (as_slot_ensure): Remove function. (as_init): Replace use of slot_lookup_rel with as_slot_lookup_use or as_cap_lookup as appropriate. (cap_lookup): Remove function. (object_lookup): Likewise. (slot_lookup): Likewise. (as_dump): Likewise. * as-build.c: Don't include "as.h", but <hurd/as.h>. Include <hurd/rm.h>, "as-compute-gbits.h". [RM_INTERN]: Don't include "object.h" but "../viengoos/object.h". (CUSTOM) [ID_SUFFIX]: Define. (as_build_internal): Rename from this... (as_build): ... to this. Remove static qualifier. Replace parameter allocate_object with allocate_page_table. Use it instead. (as_slot_ensure_full): Remove function. (as_insert): Likewise. * as-build-custom.c (as_object_index_t): Remove definition. (AS_LOCK): Don't define. (AS_UNLOCK): Don't define. (as_ensure_full_custom): New function. (as_insert_custom): Likewise. * as-lookup.c: Include <hurd/as.h>. [RM_INTERN]: Don't include "object.h" but "../viengoos/object.h". [! RM_INTERN]: Include <pthread.h>. (as_lock) [! RM_INTERN]: Rename from this... (as_rwlock) [! RM_INTERN]: ... to this. (ensure_stack) [! RM_INTERN]: Remove function. (AS_LOCK): Don't define. (AS_UNLOCK): Don't define. (lookup): Rename from this... (as_lookup_rel): ... to this. Change mode's type to an enum as_lookup_mode. Change rt's type to a union as_lookup_ret. Don't use want_object but as_lookup_want_object. Don't use want_slot but as_lookup_want_slot. Don't use want_cap but as_lookup_want_cap. (cap_lookup_rel): Remove function. (object_lookup_rel): Likewise. (slot_lookup_rel): Likewise. (print_nr): Move from here... * as-lookup.c (do_walk): Move from here... * as-dump.c (do_walk): ... to here. * as-lookup.c (as_dump_from): Move from here... * as-dump.c (as_dump_from): ... to here. * Makefile.am (lib_LIBRARIES) [ENABLE_TESTS]: Set to libas-check.a (lib_LIBRARIES) [! ENABLE_TESTS]: Add libas-kernel.a. (libhurd_mm_a_SOURCES): Add bits., as-build.c as-build-custom.c, as-lookup.c and as-dump.c. (libas_kernel_a_CPPFLAGS): New variable. (libas_kernel_a_CCASFLAGS): New variable. (libas_kernel_a_CFLAGS): New variable. (libas_kernel_a_SOURCES): New variable. (libas_check_a_CPPFLAGS): New variable. (libas_check_a_CCASFLAGS): New variable. (libas_check_a_CFLAGS): New variable. (libas_check_a_SOURCES): New variable. * anonymous.c (fault): Replace use of as_slot_ensure with as_ensure. * exceptions.c (exception_handler_init): Replace use of as_slot_ensure with as_ensure. * storage.c (storage_check_reserve_internal): Replace use of as_lock with as_rwlock. Replace use of as_slot_ensure with and slot_lookup with as_ensure and as_slot_lookup_use. (storage_alloc): Replace use of slot_lookup with as_slot_lookup_use. hurd/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * cap.h: Don't include <pthread.h>. (as_lock): Remove declaration. (cap_lookup_rel): Likewise. (object_lookup_rel): Likewise. (slot_lookup_rel): Likewise. / 2008-06-05 Neal H. Walfield <neal@gnu.org> * libc.a.in: Remove -lhurd-cap. * Makefile.am (libc-stmp): Remove dependency on viengoos/libhurd-cap.a. 2008-06-05 Neal H. Walfield <neal@gnu.org> * process-spawn.c (as_insert_custom): Replace use of as_insert with as_insert_full. (allocate_object): Change return type to struct as_allocate_pt_ret. Replace use of as_slot_ensure with as_ensure_use. (allocate_page_table): New function. (process_spawn): Update use of as_insert_custom to be consistent with new API, in particular, pass allocate_page_table instead of allocate_object. Replace use of object_lookup_rel with as_object_lookup_rel. libpthread/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * sysdeps/l4/hurd/pt-thread-alloc.c (__pthread_thread_alloc): Replace use of as_slot_ensure with as_ensure. ruth/ 2008-06-05 Neal H. Walfield <neal@gnu.org> * ruth.c (main): Replace use of slot_lookup with as_cap_lookup. Replace use of as_slot_ensure with as_ensure_use. Replace use of slot_lookup with as_slot_lookup_use.