aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/htl
AgeCommit message (Collapse)AuthorFilesLines
2021-01-02Update copyright dates with scripts/update-copyrightsPaul Eggert114-114/+114
I used these shell commands: ../glibc/scripts/update-copyrights $PWD/../gnulib/build-aux/update-copyright (cd ../glibc && git commit -am"[this commit message]") and then ignored the output, which consisted lines saying "FOO: warning: copyright statement not found" for each of 6694 files FOO. I then removed trailing white space from benchtests/bench-pthread-locks.c and iconvdata/tst-iconv-big5-hkscs-to-2ucs4.c, to work around this diagnostic from Savannah: remote: *** pre-commit check failed ... remote: *** error: lines with trailing whitespace found remote: error: hook declined to update refs/heads/master
2020-12-16htl: Get sem_open/sem_close/sem_unlink support [BZ #25524]Samuel Thibault3-93/+0
This just moves the existing nptl implementation to reuse as it is in htl.
2020-12-16htl: Add pshared semaphore supportSamuel Thibault8-184/+253
The implementation is extremely similar to the nptl implementation, but with slight differences in the futex interface. This fixes some of BZ 25521.
2020-12-16htl: Add futex-internal.hSamuel Thibault1-0/+39
That provides futex_supports_pshared
2020-12-03htl: Add hidden def for __pthread_create/detachSamuel Thibault1-0/+2
to avoid a PLT.
2020-11-15hurd: Remove some remnants of cthreadsSamuel Thibault2-2/+2
Libc has actually been using mach's lock-internal.h mutex for a long time already.
2020-11-11htl: Fix spurious symbols in namespacesSamuel Thibault5-5/+5
pthread_attr_{{get,set}stack{addr,size},setstack} were defining a strong alias for no reason, turning them to weak.
2020-06-28htl: Move cleanup handling to non-private libc-lockSamuel Thibault2-33/+70
This adds sysdeps/htl/libc-lock.h which augments sysdeps/mach/libc-lock.h with the htl-aware cleanup handling. Otherwise inclusion of libc-lock.h without libc-lockP.h would keep only the mach-aware handling. This also fixes cleanup getting called when the binary is statically-linked without libpthread. * sysdeps/htl/libc-lockP.h (__libc_cleanup_region_start, __libc_cleanup_end, __libc_cleanup_region_end, __pthread_get_cleanup_stack): Move to... * sysdeps/htl/libc-lock.h: ... new file. (__libc_cleanup_region_start): Always set handler and arg. (__libc_cleanup_end): Always call the cleanup handler. (__libc_cleanup_push, __libc_cleanup_pop): New macros.
2020-06-28htl: Fix includes for lockfileSamuel Thibault3-6/+3
These only need exactly to use __libc_ptf_call. * sysdeps/htl/flockfile.c: Include <libc-lockP.h> instead of <libc-lock.h> * sysdeps/htl/ftrylockfile.c: Include <libc-lockP.h> instead of <errno.h>, <pthread.h>, <stdio-lock.h> * sysdeps/htl/funlockfile.c: Include <libc-lockP.h> instead of <pthread.h> and <stdio-lock.h>
2020-06-24htl: Add wrapper header for <semaphore.h> with hidden __sem_postFlorian Weimer3-2/+11
This is required to avoid a check-localplt failure due to a sem_post call through the PLT. Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
2020-06-24htl: Fix case when sem_*wait is canceled while holding a tokenSamuel Thibault1-2/+13
* sysdeps/htl/sem-timedwait.c (struct cancel_ctx): Add cancel_wake field. (cancel_hook): When unblocking thread, set cancel_wake field to 1. (__sem_timedwait_internal): Set cancel_wake field to 0 by default. On cancellation exit, check whether we hold a token, to be put back.
2020-06-24htl: Make sem_*wait cancellations pointsSamuel Thibault1-8/+84
By aligning its implementation on pthread_cond_wait. * sysdeps/htl/sem-timedwait.c (cancel_ctx): New structure. (cancel_hook): New function. (__sem_timedwait_internal): Check for cancellation and register cancellation hook that wakes the thread up, and check again for cancellation on exit. * nptl/tst-cancel13.c, nptl/tst-cancelx13.c: Move to... * sysdeps/pthread/: ... here. * nptl/Makefile: Move corresponding references and rules to... * sysdeps/pthread/Makefile: ... here.
2020-06-24htl: Simplify non-cancel path of __pthread_cond_timedwait_internalSamuel Thibault1-20/+21
Since __pthread_exit does not return, we do not need to indent the noncancel path * sysdeps/htl/pt-cond-timedwait.c (__pthread_cond_timedwait_internal): Move cancelled path before non-cancelled path, to avoid "else" indentation.
2020-06-14htl: Fix cleanup support for IO lockingSamuel Thibault2-0/+90
* sysdeps/htl/stdio-lock.h: New file, registers locking cleanup to htl. * sysdeps/htl/libc-lockP.h: Include <libc-lock.h>. (__libc_cleanup_region_start, __libc_cleanup_end, __libc_cleanup_region_end): Override macros from <libc-lock.h> with versions which register cleanup to htl. (__pthread_get_cleanup_stack): Make reference weak for skipping registration on in the static non-libpthread case.
2020-06-14htl: Add noreturn attribute on __pthread_exit forwardSamuel Thibault1-2/+2
* sysdeps/htl/pthread-functions.h (__pthread_exit): Add noreturn attribute. (struct pthread_functions): Add noreturn attribute on ptr___pthread_exit field.
2020-06-07htl: Fix registration of atfork handlers in modulesSamuel Thibault2-2/+12
We really need modules to use their own pthread_atfork so that __dso_handle properly identifies them. * sysdeps/htl/pt-atfork.c (__pthread_atfork): Hide function. (pthread_atfork): Hide alias. * sysdeps/htl/old_pt-atfork.c (pthread_atfork): Rename macro to __pthread_atfork to fix building the compatibility alias.
2020-06-07htl: Fix tls initialization for already-created threadsSamuel Thibault1-0/+3
* sysdeps/htl/pthreadP.h: Include <link.h> (__pthread_init_static_tls): New prototype. * htl/pt-alloc.c (__pthread_init_static_tls): New function. * sysdeps/mach/hurd/htl/pt-sysdep.c (_init_routine): Initialize tcb field of initial thread. Set GL(dl_init_static_tls) to &__pthread_init_static_tls.
2020-06-07htl: Add sem_clockwait supportSamuel Thibault2-3/+12
* sysdeps/htl/sem-timedwait.c (__sem_timedwait_internal): Add clock_id parameter instead of hardcoding CLOCK_REALTIME. (__sem_clockwait): New function. (sem_clockwait): New weak alias. * sysdeps/htl/sem-wait.c (__sem_timedwait_internal): Update declaration. (__sem_wait): Update call to __sem_timedwait_internal. * htl/Versions (GLIBC_2.32): Add sem_clockwait. * sysdeps/mach/hurd/i386/libpthread.abilist (sem_clockwait): Add symbol. * nptl/Makefile (tests): Move tst-sem5 to... * sysdeps/pthread/Makefile (tests): ... here.
2020-06-01htl: Fix gsync_wait symbol expositionSamuel Thibault1-1/+1
* sysdeps/htl/pt-cond-destroy.c (__pthread_cond_destroy): Call __gsync_wait instead of gsync_wait.
2020-06-01htl: Make pthread_cond_destroy wait for threads to be wokenSamuel Thibault3-5/+28
This allows to reuse the storage after calling pthread_cond_destroy. * sysdeps/htl/bits/types/struct___pthread_cond.h (__pthread_cond): Replace unused struct __pthread_condimpl *__impl field with unsigned int __wrefs. (__PTHREAD_COND_INITIALIZER): Update accordingly. * sysdeps/htl/pt-cond-timedwait.c (__pthread_cond_timedwait_internal): Register as waiter in __wrefs field. On unregistering, wake any pending pthread_cond_destroy. * sysdeps/htl/pt-cond-destroy.c (__pthread_cond_destroy): Register wake request in __wrefs. * nptl/Makefile (tests): Move tst-cond20 tst-cond21 to... * sysdeps/pthread/Makefile (tests): ... here. * nptl/tst-cond20.c nptl/tst-cond21.c: Move to... * sysdeps/pthread/tst-cond20.c sysdeps/pthread/tst-cond21.c: ... here.
2020-05-26htl: Add clock variantsSamuel Thibault8-12/+126
* htl/pt-join.c (__pthread_join): Move implementation to... (__pthread_join_common): ... new function. Add try, timed and clock support. (__pthread_join): Reimplement on top of __pthread_join_common. (__pthread_tryjoin_np, __pthread_timedjoin_np, __pthread_clockjoin_np): Implement on top of __pthread_join_common. (pthread_tryjoin_np, pthread_timedjoin_np, pthread_clockjoin_np): New aliases. * hurd/hurdlock.c (__lll_abstimed_wait, __lll_abstimed_xwait, __lll_abstimed_lock): Check for supported clock. * sysdeps/htl/pt-cond-timedwait.c (__pthread_cond_timedwait_internal): Add clockid parameter and support it. (__pthread_cond_timedwait): Pass -1 as clockid. (__pthread_cond_clockwait): New function. (pthread_cond_clockwait): New alias. * sysdeps/htl/pt-cond-wait.c (__pthread_cond_timedwait_internal): Update prototype. (__pthread_cond_wait): Pass -1 as clockid. * sysdeps/htl/pt-rwlock-timedrdlock.c (__pthread_rwlock_timedrdlock_internal): Add clockid parameter, and support id. (__pthread_rwlock_clockrdlock): New function. (pthread_rwlock_clockrdlock): New alias. * sysdeps/htl/pt-rwlock-rdlock.c (__pthread_rwlock_timedrdlock_internal): Update prototype. (__pthread_rwlock_rdlock): Pass -1 as clockid. * sysdeps/htl/pt-rwlock-timedwrlock.c (__pthread_rwlock_timedwrlock_internal): Add clockid parameter, and support id. (__pthread_rwlock_clockwrlock): New function. (pthread_rwlock_clockwrlock): New alias. * sysdeps/htl/pt-rwlock-wrlock.c (__pthread_rwlock_timedwrlock_internal): Update prototype. (__pthread_rwlock_wrlock): Pass -1 as clockid. * sysdeps/mach/hurd/htl/pt-mutex-timedlock.c (__pthread_mutex_timedlock): Move implementation to (__pthread_mutex_clocklock): New function with additional clockid parameter and support it. (pthread_mutex_clocklock): New alias. (__pthread_mutex_timedlock): Reimplement on top of __pthread_mutex_clocklock. * sysdeps/htl/pthread.h (pthread_tryjoin_np, pthread_timedjoin_np, pthread_clockjoin_np, pthread_mutex_clocklock, pthread_cond_clockwait, pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock): New prototypes. * sysdeps/htl/pthreadP.h (__pthread_cond_clockwait): New prototype. * htl/Versions (GLIBC_2.32): Add pthread_cond_clockwait, pthread_mutex_clocklock, pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock, pthread_tryjoin_np, pthread_timedjoin_np, pthread_clockjoin_np. * sysdeps/mach/hurd/i386/libpthread.abilist (pthread_clockjoin_np, pthread_cond_clockwait, pthread_mutex_clocklock, pthread_rwlock_clockrdlock, pthread_rwlock_clockwrlock, pthread_timedjoin_np, pthread_tryjoin_np): New functions. * nptl/tst-abstime.c, nptl/tst-join10.c, nptl/tst-join11.c, nptl/tst-join12.c, nptl/tst-join13.c, nptl/tst-join14.c, nptl/tst-join2.c, nptl/tst-join3.c, nptl/tst-join8.c, nptl/tst-join9.c, nptl/tst-mutex-errorcheck.c, nptl/tst-pthread-mutexattr.c, nptl/tst-mutex11.c, nptl/tst-mutex5.c, nptl/tst-mutex7.c, nptl/tst-mutex7robus.c, nptl/tst-mutex9.c, nptl/tst-rwlock12.c, nptl/tst-rwlock14.c: Move to sysdeps/pthread. * sysdeps/pthread/tst-mutex8.c: Move back to nptl. * nptl/Makefile (tests): Move tst-mutex5, tst-mutex7, tst-mutex7robust, tst-mutex9, tst-mutex11, tst-rwlock12, tst-rwlock14, tst-join2, tst-join3, tst-join8, tst-join9 tst-join10, tst-join11, tst-join12, tst-join13, tst-join14, tst-abstime, tst-mutex-errorcheck, tst-pthread-mutexattr to ... * sysdeps/pthread/Makefile (tests): ... here.
2020-02-16pthread: Move robust mutex tests from nptl to sysdeps/pthreadSamuel Thibault1-0/+2
tst-robust8.c prints some mutex internals for nptl debugging, this needed to be made conditioned by getting built with nptl.
2020-02-16htl: Add missing functions and defines for robust mutexesSamuel Thibault1-0/+1
2020-02-10htl C11 threads: Avoid pthread_ symbols visibility in static librarySamuel Thibault28-28/+28
2020-02-11hurd: Add __pthread_spin_wait and use itSamuel Thibault15-21/+21
900778283ac3 ("htl: make pthread_spin_lock really spin") made pthread_spin_lock really spin and not block, but the current users of __pthread_spin_lock were assuming that it blocks, i.e. they use it as a lightweight mutex fitting in just one int. __pthread_spin_wait provides that support back.
2020-02-10htl: Fix barrier_wait with one threadSamuel Thibault1-1/+3
2020-02-10htl: Make sem_wait/sem_timedwait interruptibleSamuel Thibault1-6/+4
2020-02-10htl: Make sem_open return ENOSYSSamuel Thibault1-1/+1
instead of EOPNOTSUPP, which is for sockets.
2020-02-10htl: Add support for semaphore maximum valueSamuel Thibault1-0/+7
2020-02-10htl: Add support for libc cancellation pointsSamuel Thibault1-0/+1
2020-02-10htl: clean __pthread_get_cleanup_stack hidden protoSamuel Thibault1-1/+1
2020-02-09htl: support cancellation during pthread_onceSamuel Thibault1-0/+10
2020-02-09htl: make pthread_cond_destroy return EBUSY on waitersSamuel Thibault1-1/+8
2020-02-09htl: Report missing mutex lock on pthread_cond_*waitSamuel Thibault1-0/+4
2020-02-09htl: Fix default guard sizeSamuel Thibault1-1/+1
When it is not hardcoded by the architecture with PAGESIZE, we need to use the dynamic values from __vm_page_size.
2020-02-09htl: Avoid check-installed-headers looking at inlinesSamuel Thibault1-2/+4
2020-02-09htl: Do not put spin_lock inlines in public headersSamuel Thibault2-36/+36
They were not getting used anyway. Also do not make libsupport use them, it would make tests using it have to be made to link against libmachuser for gsync_wait.
2020-02-09C11 threads: Move implementation to sysdeps/pthreadSamuel Thibault3-1/+33
so it gets shared by nptl and htl. Also add htl versions of thrd_current and thrd_yield. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-09htl: Add C11 threads types definitionsSamuel Thibault1-0/+13
2020-02-09htl: Make __PTHREAD_ONCE_INIT more flexibleSamuel Thibault2-2/+2
by moving its (struct __pthread_once) cast into PTHREAD_ONCE_INIT. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-09htl: Add support for C11 threads behaviorSamuel Thibault1-0/+3
Essentially properly calling the thread function which returns an int instead of a void*. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
2020-02-09htl: Add missing internal functions declarationsSamuel Thibault1-0/+13
2020-02-09htl: Rename _pthread_mutex_init/destroy to __pthread_mutex_init/destroySamuel Thibault2-3/+4
2020-02-09htl: Remove unused filesSamuel Thibault23-1099/+0
These have never been used.
2020-01-13htl: Add internal version of __pthread_mutex_timedlockSamuel Thibault2-1/+4
The C11 threads implementation will need it.
2020-01-13htl: Avoid exposing unixoid functionsSamuel Thibault1-1/+1
C11 threads should not expose them.
2020-01-13htl: Add type sizes in bits/pthreadtypes-arch.h and check themSamuel Thibault11-0/+24
2020-01-13htl: Add internal versions of functions used by C11 threadsSamuel Thibault3-1/+5
The C11 threads implementation needs to call pthread_join and pthread_key_delete without exposing them.
2020-01-04htl: Add __errno_location and __h_errno_locationSamuel Thibault1-0/+4
As explained on https://sourceware.org/ml/libc-alpha/2020-01/msg00049.html the presence of __errno_location in libpthread.so on GNU/Linux makes libpthread getting linked in for libstdc++. This aligns on that behavior, to avoid issues that only GNU/Hurd would get.
2020-01-04htl: Move pthread_atfork to libc_nonshared.aSamuel Thibault2-3/+3
This follows bd60ce86520b ('nptl: Move pthread_atfork to libc_nonshared.a') with the same rationale: there is no non-libpthread equivalent to be used for making linking against libpthread optional. libpthread_nonshared.a is unused after this, so remove it from the build. There is no ABI impact because pthread_atfork was implemented using __register_atfork in libc even before this change. pthread_atfork has to be a weak alias because pthread_* names are not reserved in libc.