glibc/htl/pt-create.c

288 lines
8.6 KiB
C
Raw Normal View History

/* Thread creation.
Copyright (C) 2000-2022 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
hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+ * htl/Makefile: Bump licence to LGPL 2.1+. * htl/alloca_cutoff.c: Likewise. * htl/cthreads-compat.c: Likewise. * htl/lockfile.c: Likewise. * htl/pt-alloc.c: Likewise. * htl/pt-cancel.c: Likewise. * htl/pt-cleanup.c: Likewise. * htl/pt-create.c: Likewise. * htl/pt-dealloc.c: Likewise. * htl/pt-detach.c: Likewise. * htl/pt-exit.c: Likewise. * htl/pt-getattr.c: Likewise. * htl/pt-initialize.c: Likewise. * htl/pt-internal.h: Likewise. * htl/pt-join.c: Likewise. * htl/pt-self.c: Likewise. * htl/pt-setcancelstate.c: Likewise. * htl/pt-setcanceltype.c: Likewise. * htl/pt-sigmask.c: Likewise. * htl/pt-spin-inlines.c: Likewise. * htl/pt-testcancel.c: Likewise. * htl/pt-yield.c: Likewise. * htl/tests/test-1.c: Likewise. * htl/tests/test-10.c: Likewise. * htl/tests/test-11.c: Likewise. * htl/tests/test-12.c: Likewise. * htl/tests/test-13.c: Likewise. * htl/tests/test-14.c: Likewise. * htl/tests/test-15.c: Likewise. * htl/tests/test-16.c: Likewise. * htl/tests/test-17.c: Likewise. * htl/tests/test-2.c: Likewise. * htl/tests/test-3.c: Likewise. * htl/tests/test-4.c: Likewise. * htl/tests/test-5.c: Likewise. * htl/tests/test-6.c: Likewise. * htl/tests/test-7.c: Likewise. * htl/tests/test-8.c: Likewise. * htl/tests/test-9.c: Likewise. * htl/tests/test-__pthread_destroy_specific-skip.c: Likewise. * sysdeps/htl/bits/cancelation.h: Likewise. * sysdeps/htl/bits/pthread-np.h: Likewise. * sysdeps/htl/bits/pthread.h: Likewise. * sysdeps/htl/bits/pthreadtypes.h: Likewise. * sysdeps/htl/bits/semaphore.h: Likewise. * sysdeps/htl/bits/types/__pthread_key.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_attr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrier.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrierattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_cond.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_condattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutexattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_once.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlock.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlockattr.h: Likewise. * sysdeps/htl/old_pt-atfork.c: Likewise. * sysdeps/htl/pt-atfork.c: Likewise. * sysdeps/htl/pt-attr-destroy.c: Likewise. * sysdeps/htl/pt-attr-getdetachstate.c: Likewise. * sysdeps/htl/pt-attr-getguardsize.c: Likewise. * sysdeps/htl/pt-attr-getinheritsched.c: Likewise. * sysdeps/htl/pt-attr-getschedparam.c: Likewise. * sysdeps/htl/pt-attr-getschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-getscope.c: Likewise. * sysdeps/htl/pt-attr-getstack.c: Likewise. * sysdeps/htl/pt-attr-getstackaddr.c: Likewise. * sysdeps/htl/pt-attr-getstacksize.c: Likewise. * sysdeps/htl/pt-attr-init.c: Likewise. * sysdeps/htl/pt-attr-setdetachstate.c: Likewise. * sysdeps/htl/pt-attr-setguardsize.c: Likewise. * sysdeps/htl/pt-attr-setinheritsched.c: Likewise. * sysdeps/htl/pt-attr-setschedparam.c: Likewise. * sysdeps/htl/pt-attr-setschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-setscope.c: Likewise. * sysdeps/htl/pt-attr-setstack.c: Likewise. * sysdeps/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/htl/pt-attr.c: Likewise. * sysdeps/htl/pt-barrier-destroy.c: Likewise. * sysdeps/htl/pt-barrier-init.c: Likewise. * sysdeps/htl/pt-barrier-wait.c: Likewise. * sysdeps/htl/pt-barrier.c: Likewise. * sysdeps/htl/pt-barrierattr-destroy.c: Likewise. * sysdeps/htl/pt-barrierattr-getpshared.c: Likewise. * sysdeps/htl/pt-barrierattr-init.c: Likewise. * sysdeps/htl/pt-barrierattr-setpshared.c: Likewise. * sysdeps/htl/pt-cond-brdcast.c: Likewise. * sysdeps/htl/pt-cond-destroy.c: Likewise. * sysdeps/htl/pt-cond-init.c: Likewise. * sysdeps/htl/pt-cond-signal.c: Likewise. * sysdeps/htl/pt-cond-timedwait.c: Likewise. * sysdeps/htl/pt-cond-wait.c: Likewise. * sysdeps/htl/pt-cond.c: Likewise. * sysdeps/htl/pt-condattr-destroy.c: Likewise. * sysdeps/htl/pt-condattr-getclock.c: Likewise. * sysdeps/htl/pt-condattr-getpshared.c: Likewise. * sysdeps/htl/pt-condattr-init.c: Likewise. * sysdeps/htl/pt-condattr-setclock.c: Likewise. * sysdeps/htl/pt-condattr-setpshared.c: Likewise. * sysdeps/htl/pt-destroy-specific.c: Likewise. * sysdeps/htl/pt-equal.c: Likewise. * sysdeps/htl/pt-getconcurrency.c: Likewise. * sysdeps/htl/pt-getcpuclockid.c: Likewise. * sysdeps/htl/pt-getschedparam.c: Likewise. * sysdeps/htl/pt-getspecific.c: Likewise. * sysdeps/htl/pt-init-specific.c: Likewise. * sysdeps/htl/pt-key-create.c: Likewise. * sysdeps/htl/pt-key-delete.c: Likewise. * sysdeps/htl/pt-key.h: Likewise. * sysdeps/htl/pt-mutex-destroy.c: Likewise. * sysdeps/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-init.c: Likewise. * sysdeps/htl/pt-mutex-lock.c: Likewise. * sysdeps/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/htl/pt-mutex-trylock.c: Likewise. * sysdeps/htl/pt-mutex-unlock.c: Likewise. * sysdeps/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/htl/pt-mutexattr-init.c: Likewise. * sysdeps/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/htl/pt-mutexattr.c: Likewise. * sysdeps/htl/pt-once.c: Likewise. * sysdeps/htl/pt-rwlock-attr.c: Likewise. * sysdeps/htl/pt-rwlock-destroy.c: Likewise. * sysdeps/htl/pt-rwlock-init.c: Likewise. * sysdeps/htl/pt-rwlock-rdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedwrlock.c: Likewise. * sysdeps/htl/pt-rwlock-tryrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-trywrlock.c: Likewise. * sysdeps/htl/pt-rwlock-unlock.c: Likewise. * sysdeps/htl/pt-rwlock-wrlock.c: Likewise. * sysdeps/htl/pt-rwlockattr-destroy.c: Likewise. * sysdeps/htl/pt-rwlockattr-getpshared.c: Likewise. * sysdeps/htl/pt-rwlockattr-init.c: Likewise. * sysdeps/htl/pt-rwlockattr-setpshared.c: Likewise. * sysdeps/htl/pt-setconcurrency.c: Likewise. * sysdeps/htl/pt-setschedparam.c: Likewise. * sysdeps/htl/pt-setschedprio.c: Likewise. * sysdeps/htl/pt-setspecific.c: Likewise. * sysdeps/htl/pt-spin.c: Likewise. * sysdeps/htl/pt-startup.c: Likewise. * sysdeps/htl/pthread.h: Likewise. * sysdeps/htl/sem-close.c: Likewise. * sysdeps/htl/sem-destroy.c: Likewise. * sysdeps/htl/sem-getvalue.c: Likewise. * sysdeps/htl/sem-init.c: Likewise. * sysdeps/htl/sem-open.c: Likewise. * sysdeps/htl/sem-post.c: Likewise. * sysdeps/htl/sem-timedwait.c: Likewise. * sysdeps/htl/sem-trywait.c: Likewise. * sysdeps/htl/sem-unlink.c: Likewise. * sysdeps/htl/sem-wait.c: Likewise. * sysdeps/hurd/htl/pt-kill.c: Likewise. * sysdeps/i386/htl/pt-machdep.h: Likewise. * sysdeps/mach/htl/pt-block.c: Likewise. * sysdeps/mach/htl/pt-spin.c: Likewise. * sysdeps/mach/htl/pt-stack-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-start.c: Likewise. * sysdeps/mach/htl/pt-thread-terminate.c: Likewise. * sysdeps/mach/htl/pt-timedblock.c: Likewise. * sysdeps/mach/htl/pt-wakeup.c: Likewise. * sysdeps/mach/hurd/htl/bits/pthread-np.h: Likewise. * sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/mach/hurd/htl/pt-docancel.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-wait.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-consistent.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-lock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-trylock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-unlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.h: Likewise. * sysdeps/mach/hurd/i386/htl/pt-machdep.c: Likewise. * sysdeps/mach/hurd/i386/htl/pt-setup.c: Likewise.
2018-04-02 16:37:36 +02:00
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
hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+ * htl/Makefile: Bump licence to LGPL 2.1+. * htl/alloca_cutoff.c: Likewise. * htl/cthreads-compat.c: Likewise. * htl/lockfile.c: Likewise. * htl/pt-alloc.c: Likewise. * htl/pt-cancel.c: Likewise. * htl/pt-cleanup.c: Likewise. * htl/pt-create.c: Likewise. * htl/pt-dealloc.c: Likewise. * htl/pt-detach.c: Likewise. * htl/pt-exit.c: Likewise. * htl/pt-getattr.c: Likewise. * htl/pt-initialize.c: Likewise. * htl/pt-internal.h: Likewise. * htl/pt-join.c: Likewise. * htl/pt-self.c: Likewise. * htl/pt-setcancelstate.c: Likewise. * htl/pt-setcanceltype.c: Likewise. * htl/pt-sigmask.c: Likewise. * htl/pt-spin-inlines.c: Likewise. * htl/pt-testcancel.c: Likewise. * htl/pt-yield.c: Likewise. * htl/tests/test-1.c: Likewise. * htl/tests/test-10.c: Likewise. * htl/tests/test-11.c: Likewise. * htl/tests/test-12.c: Likewise. * htl/tests/test-13.c: Likewise. * htl/tests/test-14.c: Likewise. * htl/tests/test-15.c: Likewise. * htl/tests/test-16.c: Likewise. * htl/tests/test-17.c: Likewise. * htl/tests/test-2.c: Likewise. * htl/tests/test-3.c: Likewise. * htl/tests/test-4.c: Likewise. * htl/tests/test-5.c: Likewise. * htl/tests/test-6.c: Likewise. * htl/tests/test-7.c: Likewise. * htl/tests/test-8.c: Likewise. * htl/tests/test-9.c: Likewise. * htl/tests/test-__pthread_destroy_specific-skip.c: Likewise. * sysdeps/htl/bits/cancelation.h: Likewise. * sysdeps/htl/bits/pthread-np.h: Likewise. * sysdeps/htl/bits/pthread.h: Likewise. * sysdeps/htl/bits/pthreadtypes.h: Likewise. * sysdeps/htl/bits/semaphore.h: Likewise. * sysdeps/htl/bits/types/__pthread_key.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_attr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrier.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrierattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_cond.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_condattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutexattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_once.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlock.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlockattr.h: Likewise. * sysdeps/htl/old_pt-atfork.c: Likewise. * sysdeps/htl/pt-atfork.c: Likewise. * sysdeps/htl/pt-attr-destroy.c: Likewise. * sysdeps/htl/pt-attr-getdetachstate.c: Likewise. * sysdeps/htl/pt-attr-getguardsize.c: Likewise. * sysdeps/htl/pt-attr-getinheritsched.c: Likewise. * sysdeps/htl/pt-attr-getschedparam.c: Likewise. * sysdeps/htl/pt-attr-getschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-getscope.c: Likewise. * sysdeps/htl/pt-attr-getstack.c: Likewise. * sysdeps/htl/pt-attr-getstackaddr.c: Likewise. * sysdeps/htl/pt-attr-getstacksize.c: Likewise. * sysdeps/htl/pt-attr-init.c: Likewise. * sysdeps/htl/pt-attr-setdetachstate.c: Likewise. * sysdeps/htl/pt-attr-setguardsize.c: Likewise. * sysdeps/htl/pt-attr-setinheritsched.c: Likewise. * sysdeps/htl/pt-attr-setschedparam.c: Likewise. * sysdeps/htl/pt-attr-setschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-setscope.c: Likewise. * sysdeps/htl/pt-attr-setstack.c: Likewise. * sysdeps/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/htl/pt-attr.c: Likewise. * sysdeps/htl/pt-barrier-destroy.c: Likewise. * sysdeps/htl/pt-barrier-init.c: Likewise. * sysdeps/htl/pt-barrier-wait.c: Likewise. * sysdeps/htl/pt-barrier.c: Likewise. * sysdeps/htl/pt-barrierattr-destroy.c: Likewise. * sysdeps/htl/pt-barrierattr-getpshared.c: Likewise. * sysdeps/htl/pt-barrierattr-init.c: Likewise. * sysdeps/htl/pt-barrierattr-setpshared.c: Likewise. * sysdeps/htl/pt-cond-brdcast.c: Likewise. * sysdeps/htl/pt-cond-destroy.c: Likewise. * sysdeps/htl/pt-cond-init.c: Likewise. * sysdeps/htl/pt-cond-signal.c: Likewise. * sysdeps/htl/pt-cond-timedwait.c: Likewise. * sysdeps/htl/pt-cond-wait.c: Likewise. * sysdeps/htl/pt-cond.c: Likewise. * sysdeps/htl/pt-condattr-destroy.c: Likewise. * sysdeps/htl/pt-condattr-getclock.c: Likewise. * sysdeps/htl/pt-condattr-getpshared.c: Likewise. * sysdeps/htl/pt-condattr-init.c: Likewise. * sysdeps/htl/pt-condattr-setclock.c: Likewise. * sysdeps/htl/pt-condattr-setpshared.c: Likewise. * sysdeps/htl/pt-destroy-specific.c: Likewise. * sysdeps/htl/pt-equal.c: Likewise. * sysdeps/htl/pt-getconcurrency.c: Likewise. * sysdeps/htl/pt-getcpuclockid.c: Likewise. * sysdeps/htl/pt-getschedparam.c: Likewise. * sysdeps/htl/pt-getspecific.c: Likewise. * sysdeps/htl/pt-init-specific.c: Likewise. * sysdeps/htl/pt-key-create.c: Likewise. * sysdeps/htl/pt-key-delete.c: Likewise. * sysdeps/htl/pt-key.h: Likewise. * sysdeps/htl/pt-mutex-destroy.c: Likewise. * sysdeps/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-init.c: Likewise. * sysdeps/htl/pt-mutex-lock.c: Likewise. * sysdeps/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/htl/pt-mutex-trylock.c: Likewise. * sysdeps/htl/pt-mutex-unlock.c: Likewise. * sysdeps/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/htl/pt-mutexattr-init.c: Likewise. * sysdeps/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/htl/pt-mutexattr.c: Likewise. * sysdeps/htl/pt-once.c: Likewise. * sysdeps/htl/pt-rwlock-attr.c: Likewise. * sysdeps/htl/pt-rwlock-destroy.c: Likewise. * sysdeps/htl/pt-rwlock-init.c: Likewise. * sysdeps/htl/pt-rwlock-rdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedwrlock.c: Likewise. * sysdeps/htl/pt-rwlock-tryrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-trywrlock.c: Likewise. * sysdeps/htl/pt-rwlock-unlock.c: Likewise. * sysdeps/htl/pt-rwlock-wrlock.c: Likewise. * sysdeps/htl/pt-rwlockattr-destroy.c: Likewise. * sysdeps/htl/pt-rwlockattr-getpshared.c: Likewise. * sysdeps/htl/pt-rwlockattr-init.c: Likewise. * sysdeps/htl/pt-rwlockattr-setpshared.c: Likewise. * sysdeps/htl/pt-setconcurrency.c: Likewise. * sysdeps/htl/pt-setschedparam.c: Likewise. * sysdeps/htl/pt-setschedprio.c: Likewise. * sysdeps/htl/pt-setspecific.c: Likewise. * sysdeps/htl/pt-spin.c: Likewise. * sysdeps/htl/pt-startup.c: Likewise. * sysdeps/htl/pthread.h: Likewise. * sysdeps/htl/sem-close.c: Likewise. * sysdeps/htl/sem-destroy.c: Likewise. * sysdeps/htl/sem-getvalue.c: Likewise. * sysdeps/htl/sem-init.c: Likewise. * sysdeps/htl/sem-open.c: Likewise. * sysdeps/htl/sem-post.c: Likewise. * sysdeps/htl/sem-timedwait.c: Likewise. * sysdeps/htl/sem-trywait.c: Likewise. * sysdeps/htl/sem-unlink.c: Likewise. * sysdeps/htl/sem-wait.c: Likewise. * sysdeps/hurd/htl/pt-kill.c: Likewise. * sysdeps/i386/htl/pt-machdep.h: Likewise. * sysdeps/mach/htl/pt-block.c: Likewise. * sysdeps/mach/htl/pt-spin.c: Likewise. * sysdeps/mach/htl/pt-stack-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-start.c: Likewise. * sysdeps/mach/htl/pt-thread-terminate.c: Likewise. * sysdeps/mach/htl/pt-timedblock.c: Likewise. * sysdeps/mach/htl/pt-wakeup.c: Likewise. * sysdeps/mach/hurd/htl/bits/pthread-np.h: Likewise. * sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/mach/hurd/htl/pt-docancel.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-wait.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-consistent.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-lock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-trylock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-unlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.h: Likewise. * sysdeps/mach/hurd/i386/htl/pt-machdep.c: Likewise. * sysdeps/mach/hurd/i386/htl/pt-setup.c: Likewise.
2018-04-02 16:37:36 +02:00
Lesser General Public License for more details.
hurd: Bump remaining LGPL2+ htl licences to LGPL 2.1+ * htl/Makefile: Bump licence to LGPL 2.1+. * htl/alloca_cutoff.c: Likewise. * htl/cthreads-compat.c: Likewise. * htl/lockfile.c: Likewise. * htl/pt-alloc.c: Likewise. * htl/pt-cancel.c: Likewise. * htl/pt-cleanup.c: Likewise. * htl/pt-create.c: Likewise. * htl/pt-dealloc.c: Likewise. * htl/pt-detach.c: Likewise. * htl/pt-exit.c: Likewise. * htl/pt-getattr.c: Likewise. * htl/pt-initialize.c: Likewise. * htl/pt-internal.h: Likewise. * htl/pt-join.c: Likewise. * htl/pt-self.c: Likewise. * htl/pt-setcancelstate.c: Likewise. * htl/pt-setcanceltype.c: Likewise. * htl/pt-sigmask.c: Likewise. * htl/pt-spin-inlines.c: Likewise. * htl/pt-testcancel.c: Likewise. * htl/pt-yield.c: Likewise. * htl/tests/test-1.c: Likewise. * htl/tests/test-10.c: Likewise. * htl/tests/test-11.c: Likewise. * htl/tests/test-12.c: Likewise. * htl/tests/test-13.c: Likewise. * htl/tests/test-14.c: Likewise. * htl/tests/test-15.c: Likewise. * htl/tests/test-16.c: Likewise. * htl/tests/test-17.c: Likewise. * htl/tests/test-2.c: Likewise. * htl/tests/test-3.c: Likewise. * htl/tests/test-4.c: Likewise. * htl/tests/test-5.c: Likewise. * htl/tests/test-6.c: Likewise. * htl/tests/test-7.c: Likewise. * htl/tests/test-8.c: Likewise. * htl/tests/test-9.c: Likewise. * htl/tests/test-__pthread_destroy_specific-skip.c: Likewise. * sysdeps/htl/bits/cancelation.h: Likewise. * sysdeps/htl/bits/pthread-np.h: Likewise. * sysdeps/htl/bits/pthread.h: Likewise. * sysdeps/htl/bits/pthreadtypes.h: Likewise. * sysdeps/htl/bits/semaphore.h: Likewise. * sysdeps/htl/bits/types/__pthread_key.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_attr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrier.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_barrierattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_cond.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_condattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_mutexattr.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_once.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlock.h: Likewise. * sysdeps/htl/bits/types/struct___pthread_rwlockattr.h: Likewise. * sysdeps/htl/old_pt-atfork.c: Likewise. * sysdeps/htl/pt-atfork.c: Likewise. * sysdeps/htl/pt-attr-destroy.c: Likewise. * sysdeps/htl/pt-attr-getdetachstate.c: Likewise. * sysdeps/htl/pt-attr-getguardsize.c: Likewise. * sysdeps/htl/pt-attr-getinheritsched.c: Likewise. * sysdeps/htl/pt-attr-getschedparam.c: Likewise. * sysdeps/htl/pt-attr-getschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-getscope.c: Likewise. * sysdeps/htl/pt-attr-getstack.c: Likewise. * sysdeps/htl/pt-attr-getstackaddr.c: Likewise. * sysdeps/htl/pt-attr-getstacksize.c: Likewise. * sysdeps/htl/pt-attr-init.c: Likewise. * sysdeps/htl/pt-attr-setdetachstate.c: Likewise. * sysdeps/htl/pt-attr-setguardsize.c: Likewise. * sysdeps/htl/pt-attr-setinheritsched.c: Likewise. * sysdeps/htl/pt-attr-setschedparam.c: Likewise. * sysdeps/htl/pt-attr-setschedpolicy.c: Likewise. * sysdeps/htl/pt-attr-setscope.c: Likewise. * sysdeps/htl/pt-attr-setstack.c: Likewise. * sysdeps/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/htl/pt-attr.c: Likewise. * sysdeps/htl/pt-barrier-destroy.c: Likewise. * sysdeps/htl/pt-barrier-init.c: Likewise. * sysdeps/htl/pt-barrier-wait.c: Likewise. * sysdeps/htl/pt-barrier.c: Likewise. * sysdeps/htl/pt-barrierattr-destroy.c: Likewise. * sysdeps/htl/pt-barrierattr-getpshared.c: Likewise. * sysdeps/htl/pt-barrierattr-init.c: Likewise. * sysdeps/htl/pt-barrierattr-setpshared.c: Likewise. * sysdeps/htl/pt-cond-brdcast.c: Likewise. * sysdeps/htl/pt-cond-destroy.c: Likewise. * sysdeps/htl/pt-cond-init.c: Likewise. * sysdeps/htl/pt-cond-signal.c: Likewise. * sysdeps/htl/pt-cond-timedwait.c: Likewise. * sysdeps/htl/pt-cond-wait.c: Likewise. * sysdeps/htl/pt-cond.c: Likewise. * sysdeps/htl/pt-condattr-destroy.c: Likewise. * sysdeps/htl/pt-condattr-getclock.c: Likewise. * sysdeps/htl/pt-condattr-getpshared.c: Likewise. * sysdeps/htl/pt-condattr-init.c: Likewise. * sysdeps/htl/pt-condattr-setclock.c: Likewise. * sysdeps/htl/pt-condattr-setpshared.c: Likewise. * sysdeps/htl/pt-destroy-specific.c: Likewise. * sysdeps/htl/pt-equal.c: Likewise. * sysdeps/htl/pt-getconcurrency.c: Likewise. * sysdeps/htl/pt-getcpuclockid.c: Likewise. * sysdeps/htl/pt-getschedparam.c: Likewise. * sysdeps/htl/pt-getspecific.c: Likewise. * sysdeps/htl/pt-init-specific.c: Likewise. * sysdeps/htl/pt-key-create.c: Likewise. * sysdeps/htl/pt-key-delete.c: Likewise. * sysdeps/htl/pt-key.h: Likewise. * sysdeps/htl/pt-mutex-destroy.c: Likewise. * sysdeps/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-init.c: Likewise. * sysdeps/htl/pt-mutex-lock.c: Likewise. * sysdeps/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/htl/pt-mutex-trylock.c: Likewise. * sysdeps/htl/pt-mutex-unlock.c: Likewise. * sysdeps/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/htl/pt-mutexattr-init.c: Likewise. * sysdeps/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/htl/pt-mutexattr.c: Likewise. * sysdeps/htl/pt-once.c: Likewise. * sysdeps/htl/pt-rwlock-attr.c: Likewise. * sysdeps/htl/pt-rwlock-destroy.c: Likewise. * sysdeps/htl/pt-rwlock-init.c: Likewise. * sysdeps/htl/pt-rwlock-rdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-timedwrlock.c: Likewise. * sysdeps/htl/pt-rwlock-tryrdlock.c: Likewise. * sysdeps/htl/pt-rwlock-trywrlock.c: Likewise. * sysdeps/htl/pt-rwlock-unlock.c: Likewise. * sysdeps/htl/pt-rwlock-wrlock.c: Likewise. * sysdeps/htl/pt-rwlockattr-destroy.c: Likewise. * sysdeps/htl/pt-rwlockattr-getpshared.c: Likewise. * sysdeps/htl/pt-rwlockattr-init.c: Likewise. * sysdeps/htl/pt-rwlockattr-setpshared.c: Likewise. * sysdeps/htl/pt-setconcurrency.c: Likewise. * sysdeps/htl/pt-setschedparam.c: Likewise. * sysdeps/htl/pt-setschedprio.c: Likewise. * sysdeps/htl/pt-setspecific.c: Likewise. * sysdeps/htl/pt-spin.c: Likewise. * sysdeps/htl/pt-startup.c: Likewise. * sysdeps/htl/pthread.h: Likewise. * sysdeps/htl/sem-close.c: Likewise. * sysdeps/htl/sem-destroy.c: Likewise. * sysdeps/htl/sem-getvalue.c: Likewise. * sysdeps/htl/sem-init.c: Likewise. * sysdeps/htl/sem-open.c: Likewise. * sysdeps/htl/sem-post.c: Likewise. * sysdeps/htl/sem-timedwait.c: Likewise. * sysdeps/htl/sem-trywait.c: Likewise. * sysdeps/htl/sem-unlink.c: Likewise. * sysdeps/htl/sem-wait.c: Likewise. * sysdeps/hurd/htl/pt-kill.c: Likewise. * sysdeps/i386/htl/pt-machdep.h: Likewise. * sysdeps/mach/htl/pt-block.c: Likewise. * sysdeps/mach/htl/pt-spin.c: Likewise. * sysdeps/mach/htl/pt-stack-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-alloc.c: Likewise. * sysdeps/mach/htl/pt-thread-start.c: Likewise. * sysdeps/mach/htl/pt-thread-terminate.c: Likewise. * sysdeps/mach/htl/pt-timedblock.c: Likewise. * sysdeps/mach/htl/pt-wakeup.c: Likewise. * sysdeps/mach/hurd/htl/bits/pthread-np.h: Likewise. * sysdeps/mach/hurd/htl/bits/types/struct___pthread_mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c: Likewise. * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c: Likewise. * sysdeps/mach/hurd/htl/pt-docancel.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-timedwait.c: Likewise. * sysdeps/mach/hurd/htl/pt-hurd-cond-wait.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-consistent.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-lock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-timedlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-transfer-np.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-trylock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex-unlock.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutex.h: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-getrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-gettype.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprioceiling.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setprotocol.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setpshared.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-setrobust.c: Likewise. * sysdeps/mach/hurd/htl/pt-mutexattr-settype.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-destroy.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate-init.c: Likewise. * sysdeps/mach/hurd/htl/pt-sigstate.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.c: Likewise. * sysdeps/mach/hurd/htl/pt-sysdep.h: Likewise. * sysdeps/mach/hurd/i386/htl/pt-machdep.c: Likewise. * sysdeps/mach/hurd/i386/htl/pt-setup.c: Likewise.
2018-04-02 16:37:36 +02:00
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
Prefer https to http for gnu.org and fsf.org URLs Also, change sources.redhat.com to sourceware.org. This patch was automatically generated by running the following shell script, which uses GNU sed, and which avoids modifying files imported from upstream: sed -ri ' s,(http|ftp)(://(.*\.)?(gnu|fsf|sourceware)\.org($|[^.]|\.[^a-z])),https\2,g s,(http|ftp)(://(.*\.)?)sources\.redhat\.com($|[^.]|\.[^a-z]),https\2sourceware.org\4,g ' \ $(find $(git ls-files) -prune -type f \ ! -name '*.po' \ ! -name 'ChangeLog*' \ ! -path COPYING ! -path COPYING.LIB \ ! -path manual/fdl-1.3.texi ! -path manual/lgpl-2.1.texi \ ! -path manual/texinfo.tex ! -path scripts/config.guess \ ! -path scripts/config.sub ! -path scripts/install-sh \ ! -path scripts/mkinstalldirs ! -path scripts/move-if-change \ ! -path INSTALL ! -path locale/programs/charmap-kw.h \ ! -path po/libc.pot ! -path sysdeps/gnu/errlist.c \ ! '(' -name configure \ -execdir test -f configure.ac -o -f configure.in ';' ')' \ ! '(' -name preconfigure \ -execdir test -f preconfigure.ac ';' ')' \ -print) and then by running 'make dist-prepare' to regenerate files built from the altered files, and then executing the following to cleanup: chmod a+x sysdeps/unix/sysv/linux/riscv/configure # Omit irrelevant whitespace and comment-only changes, # perhaps from a slightly-different Autoconf version. git checkout -f \ sysdeps/csky/configure \ sysdeps/hppa/configure \ sysdeps/riscv/configure \ sysdeps/unix/sysv/linux/csky/configure # Omit changes that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/powerpc/powerpc64/ppc-mcount.S: trailing lines git checkout -f \ sysdeps/powerpc/powerpc64/ppc-mcount.S \ sysdeps/unix/sysv/linux/s390/s390-64/syscall.S # Omit change that caused a pre-commit check to fail like this: # remote: *** error: sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S: last line does not end in newline git checkout -f sysdeps/sparc/sparc64/multiarch/memcpy-ultra3.S
2019-09-07 07:40:42 +02:00
<https://www.gnu.org/licenses/>. */
#include <assert.h>
#include <errno.h>
#include <pthread.h>
#include <signal.h>
#include <resolv.h>
#include <atomic.h>
#include <hurd/resource.h>
#include <sys/single_threaded.h>
#include <pt-internal.h>
hurd: Avoid local PLTs in libpthread. * htl/cthreads-compat.c (__cthread_detach): Call __pthread_detach instead of pthread_detach. (__cthread_fork): Call __pthread_create instead of pthread_create. (__cthread_keycreate): Call __pthread_key_create instead of pthread_key_create. (__cthread_getspecific): Call __pthread_getspecific instead of pthread_getspecific. (__cthread_setspecific): Call __pthread_setspecific instead of pthread_setspecific. * htl/pt-alloc.c (__pthread_alloc): Call __pthread_mutex_lock and __pthread_mutex_unlock instead of pthread_mutex_lock and pthread_mutex_unlock. * htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to ___pthread_get_cleanup_stack. (__pthread_get_cleanup_stack): New strong alias. * htl/pt-create.c: Include <pthreadP.h>. (entry_point): Call __pthread_exit instead of pthread_exit. (pthread_create): Rename to __pthread_create. (pthread_create): New strong alias. * htl/pt-detach.c (pthread_detach): Rename to __pthread_detach. (pthread_detach): New strong alias. (__pthread_detach): Call __pthread_cond_broadcast instead of pthread_cond_broadcast. * htl/pt-exit.c (__pthread_exit): Call __pthread_setcancelstate instead of pthread_setcancelstate. * htl/pt-testcancel.c: Include <pthreadP.h>. (pthread_testcancel): Call __pthread_exit instead of pthread_exit. * sysdeps/htl/pt-attr-getstack.c: Include <pthreadP.h> (__pthread_attr_getstack): Call __pthread_attr_getstackaddr and __pthread_attr_getstacksize instead of pthread_attr_getstackaddr and pthread_attr_getstacksize. * sysdeps/htl/pt-attr-getstackaddr.c (pthread_attr_getstackaddr): Rename to __pthread_attr_getstackaddr. (pthread_attr_getstackaddr): New strong alias. * sysdeps/htl/pt-attr-getstacksize.c (pthread_attr_getstacksize): Rename to __pthread_attr_getstacksize. (pthread_attr_getstacksize): New strong alias. * sysdeps/htl/pt-attr-setstack.c: Include <pthreadP.h>. (pthread_attr_setstack): Rename to __pthread_attr_setstack. (pthread_attr_setstack): New strong alias. (__pthread_attr_setstack): Call __pthread_attr_getstacksize, __pthread_attr_setstacksize and __pthread_attr_setstackaddr instead of pthread_attr_getstacksize, pthread_attr_setstacksize and pthread_attr_setstackaddr. * sysdeps/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr. (pthread_attr_setstackaddr): New strong alias. * sysdeps/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize. (pthread_attr_setstacksize): New strong alias. * sysdeps/htl/pt-cond-timedwait.c: Include <pthreadP.h>. (__pthread_cond_timedwait_internal): Use __pthread_exit instead of pthread_exit. * sysdeps/htl/pt-key-create.c: Include <pthreadP.h>. (__pthread_key_create): New hidden def. * sysdeps/htl/pt-key.h: Include <pthreadP.h>. * sysdeps/htl/pthreadP.h (_pthread_mutex_init, __pthread_cond_broadcast, __pthread_create, __pthread_detach, __pthread_exit, __pthread_key_create, __pthread_getspecific, __pthread_setspecific, __pthread_setcancelstate, __pthread_attr_getstackaddr, __pthread_attr_setstackaddr, __pthread_attr_getstacksize, __pthread_attr_setstacksize, __pthread_attr_setstack, ___pthread_get_cleanup_stack): New declarations. (__pthread_key_create, _pthread_mutex_init): New hidden declarations. * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr. (pthread_attr_setstackaddr): New strong alias. * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize. (pthread_attr_setstacksize): New strong alias. * sysdeps/mach/hurd/htl/pt-docancel.c: Include <pthreadP.h>. (call_exit): Call __pthread_exit instead of pthread_exit. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Include <pthreadP.h>. (_pthread_mutex_init): New hidden definition. * sysdeps/mach/hurd/htl/pt-sysdep.c: Include <pthreadP.h>. (_init_routine): Call __pthread_attr_init and __pthread_attr_setstack instead of pthread_attr_init and pthread_attr_setstack.
2018-04-02 20:08:37 +02:00
#include <pthreadP.h>
#if IS_IN (libpthread)
# include <ctype.h>
#endif
#ifdef HAVE_USELOCALE
# include <locale.h>
#endif
/* The total number of pthreads currently active. This is defined
here since it would be really stupid to have a threads-using
program that doesn't call `pthread_create'. */
unsigned int __pthread_total;
/* The entry-point for new threads. */
static void
entry_point (struct __pthread *self, void *(*start_routine) (void *), void *arg)
{
int err;
___pthread_self = self;
__resp = &self->res_state;
#if IS_IN (libpthread)
/* Initialize pointers to locale data. */
__ctype_init ();
#endif
#ifdef HAVE_USELOCALE
/* A fresh thread needs to be bound to the global locale. */
uselocale (LC_GLOBAL_LOCALE);
#endif
__pthread_startup ();
/* We can now unleash signals. */
err = __pthread_sigstate (self, SIG_SETMASK, &self->init_sigset, 0, 0);
assert_perror (err);
if (self->c11)
{
/* The function pointer of the c11 thread start is cast to an incorrect
type on __pthread_create call, however it is casted back to correct
one so the call behavior is well-defined (it is assumed that pointers
to void are able to represent all values of int). */
int (*start)(void*) = (int (*) (void*)) start_routine;
__pthread_exit ((void*) (uintptr_t) start (arg));
}
else
__pthread_exit (start_routine (arg));
}
/* Create a thread with attributes given by ATTR, executing
START_ROUTINE with argument ARG. */
int
hurd: Avoid local PLTs in libpthread. * htl/cthreads-compat.c (__cthread_detach): Call __pthread_detach instead of pthread_detach. (__cthread_fork): Call __pthread_create instead of pthread_create. (__cthread_keycreate): Call __pthread_key_create instead of pthread_key_create. (__cthread_getspecific): Call __pthread_getspecific instead of pthread_getspecific. (__cthread_setspecific): Call __pthread_setspecific instead of pthread_setspecific. * htl/pt-alloc.c (__pthread_alloc): Call __pthread_mutex_lock and __pthread_mutex_unlock instead of pthread_mutex_lock and pthread_mutex_unlock. * htl/pt-cleanup.c (__pthread_get_cleanup_stack): Rename to ___pthread_get_cleanup_stack. (__pthread_get_cleanup_stack): New strong alias. * htl/pt-create.c: Include <pthreadP.h>. (entry_point): Call __pthread_exit instead of pthread_exit. (pthread_create): Rename to __pthread_create. (pthread_create): New strong alias. * htl/pt-detach.c (pthread_detach): Rename to __pthread_detach. (pthread_detach): New strong alias. (__pthread_detach): Call __pthread_cond_broadcast instead of pthread_cond_broadcast. * htl/pt-exit.c (__pthread_exit): Call __pthread_setcancelstate instead of pthread_setcancelstate. * htl/pt-testcancel.c: Include <pthreadP.h>. (pthread_testcancel): Call __pthread_exit instead of pthread_exit. * sysdeps/htl/pt-attr-getstack.c: Include <pthreadP.h> (__pthread_attr_getstack): Call __pthread_attr_getstackaddr and __pthread_attr_getstacksize instead of pthread_attr_getstackaddr and pthread_attr_getstacksize. * sysdeps/htl/pt-attr-getstackaddr.c (pthread_attr_getstackaddr): Rename to __pthread_attr_getstackaddr. (pthread_attr_getstackaddr): New strong alias. * sysdeps/htl/pt-attr-getstacksize.c (pthread_attr_getstacksize): Rename to __pthread_attr_getstacksize. (pthread_attr_getstacksize): New strong alias. * sysdeps/htl/pt-attr-setstack.c: Include <pthreadP.h>. (pthread_attr_setstack): Rename to __pthread_attr_setstack. (pthread_attr_setstack): New strong alias. (__pthread_attr_setstack): Call __pthread_attr_getstacksize, __pthread_attr_setstacksize and __pthread_attr_setstackaddr instead of pthread_attr_getstacksize, pthread_attr_setstacksize and pthread_attr_setstackaddr. * sysdeps/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr. (pthread_attr_setstackaddr): New strong alias. * sysdeps/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize. (pthread_attr_setstacksize): New strong alias. * sysdeps/htl/pt-cond-timedwait.c: Include <pthreadP.h>. (__pthread_cond_timedwait_internal): Use __pthread_exit instead of pthread_exit. * sysdeps/htl/pt-key-create.c: Include <pthreadP.h>. (__pthread_key_create): New hidden def. * sysdeps/htl/pt-key.h: Include <pthreadP.h>. * sysdeps/htl/pthreadP.h (_pthread_mutex_init, __pthread_cond_broadcast, __pthread_create, __pthread_detach, __pthread_exit, __pthread_key_create, __pthread_getspecific, __pthread_setspecific, __pthread_setcancelstate, __pthread_attr_getstackaddr, __pthread_attr_setstackaddr, __pthread_attr_getstacksize, __pthread_attr_setstacksize, __pthread_attr_setstack, ___pthread_get_cleanup_stack): New declarations. (__pthread_key_create, _pthread_mutex_init): New hidden declarations. * sysdeps/mach/hurd/htl/pt-attr-setstackaddr.c (pthread_attr_setstackaddr): Rename to __pthread_attr_setstackaddr. (pthread_attr_setstackaddr): New strong alias. * sysdeps/mach/hurd/htl/pt-attr-setstacksize.c (pthread_attr_setstacksize): Rename to __pthread_attr_setstacksize. (pthread_attr_setstacksize): New strong alias. * sysdeps/mach/hurd/htl/pt-docancel.c: Include <pthreadP.h>. (call_exit): Call __pthread_exit instead of pthread_exit. * sysdeps/mach/hurd/htl/pt-mutex-init.c: Include <pthreadP.h>. (_pthread_mutex_init): New hidden definition. * sysdeps/mach/hurd/htl/pt-sysdep.c: Include <pthreadP.h>. (_init_routine): Call __pthread_attr_init and __pthread_attr_setstack instead of pthread_attr_init and pthread_attr_setstack.
2018-04-02 20:08:37 +02:00
__pthread_create (pthread_t * thread, const pthread_attr_t * attr,
void *(*start_routine) (void *), void *arg)
{
int err;
struct __pthread *pthread;
err = __pthread_create_internal (&pthread, attr, start_routine, arg);
if (!err)
*thread = pthread->thread;
else if (err == ENOMEM)
err = EAGAIN;
return err;
}
weak_alias (__pthread_create, pthread_create)
hidden_def (__pthread_create)
/* Internal version of pthread_create. See comment in
pt-internal.h. */
int
__pthread_create_internal (struct __pthread **thread,
const pthread_attr_t * attr,
void *(*start_routine) (void *), void *arg)
{
int err;
struct __pthread *pthread;
const struct __pthread_attr *setup;
sigset_t sigset;
size_t stacksize;
/* Avoid a data race in the multi-threaded case. */
if (__libc_single_threaded)
__libc_single_threaded = 0;
/* Allocate a new thread structure. */
err = __pthread_alloc (&pthread);
if (err)
goto failed;
if (attr == ATTR_C11_THREAD)
{
attr = NULL;
pthread->c11 = true;
}
else
pthread->c11 = false;
/* Use the default attributes if ATTR is NULL. */
setup = attr ? attr : &__pthread_default_attr;
stacksize = setup->__stacksize;
if (stacksize == 0)
{
struct rlimit rlim;
__getrlimit (RLIMIT_STACK, &rlim);
if (rlim.rlim_cur != RLIM_INFINITY)
stacksize = rlim.rlim_cur;
if (stacksize == 0)
stacksize = PTHREAD_STACK_DEFAULT;
}
/* Initialize the thread state. */
pthread->state = (setup->__detachstate == PTHREAD_CREATE_DETACHED
? PTHREAD_DETACHED : PTHREAD_JOINABLE);
if (setup->__stackaddr)
{
pthread->stackaddr = setup->__stackaddr;
/* If the user supplied a stack, it is not our responsibility to
setup a stack guard. */
pthread->guardsize = 0;
pthread->stack = 0;
}
else
{
/* Allocate a stack. */
err = __pthread_stack_alloc (&pthread->stackaddr,
((setup->__guardsize + __vm_page_size - 1)
/ __vm_page_size) * __vm_page_size
+ stacksize);
if (err)
goto failed_stack_alloc;
pthread->guardsize = setup->__guardsize;
pthread->stack = 1;
}
pthread->stacksize = stacksize;
/* Allocate the kernel thread and other required resources. */
err = __pthread_thread_alloc (pthread);
if (err)
goto failed_thread_alloc;
pthread->tcb = _dl_allocate_tls (NULL);
if (pthread->tcb == NULL)
{
err = ENOMEM;
goto failed_thread_tls_alloc;
}
pthread->tcb->tcb = pthread->tcb;
/* And initialize the rest of the machine context. This may include
additional machine- and system-specific initializations that
prove convenient. */
err = __pthread_setup (pthread, entry_point, start_routine, arg);
if (err)
goto failed_setup;
/* Initialize the system-specific signal state for the new
thread. */
err = __pthread_sigstate_init (pthread);
if (err)
goto failed_sigstate;
/* If the new thread is joinable, add a reference for the caller. */
if (pthread->state == PTHREAD_JOINABLE)
pthread->nr_refs++;
/* Set the new thread's signal mask and set the pending signals to
empty. POSIX says: "The signal mask shall be inherited from the
creating thread. The set of signals pending for the new thread
shall be empty." If the currnet thread is not a pthread then we
just inherit the process' sigmask. */
if (GL (dl_pthread_num_threads) == 1)
err = __sigprocmask (0, 0, &pthread->init_sigset);
else
err = __pthread_sigstate (_pthread_self (), 0, 0, &pthread->init_sigset, 0);
assert_perror (err);
if (start_routine)
/* But block the signals for now, until the thread is fully initialized. */
__sigfillset (&sigset);
else
sigset = pthread->init_sigset;
err = __pthread_sigstate (pthread, SIG_SETMASK, &sigset, 0, 1);
assert_perror (err);
/* Increase the total number of threads. We do this before actually
starting the new thread, since the new thread might immediately
call `pthread_exit' which decreases the number of threads and
calls `exit' if the number of threads reaches zero. Increasing
the number of threads from within the new thread isn't an option
since this thread might return and call `pthread_exit' before the
new thread runs. */
atomic_fetch_add_relaxed (&__pthread_total, 1);
/* Store a pointer to this thread in the thread ID lookup table. We
could use __thread_setid, however, we only lock for reading as no
other thread should be using this entry (we also assume that the
store is atomic). */
__libc_rwlock_rdlock (GL (dl_pthread_threads_lock));
GL (dl_pthread_threads)[pthread->thread - 1] = pthread;
__libc_rwlock_unlock (GL (dl_pthread_threads_lock));
/* At this point it is possible to guess our pthread ID. We have to
make sure that all functions taking a pthread_t argument can
handle the fact that this thread isn't really running yet. Since
the new thread might be passed its ID through pthread_create (to
avoid calling pthread_self), read it before starting the thread. */
*thread = pthread;
/* Schedule the new thread. */
err = __pthread_thread_start (pthread);
if (err)
goto failed_starting;
return 0;
failed_starting:
/* If joinable, a reference was added for the caller. */
if (pthread->state == PTHREAD_JOINABLE)
{
__pthread_dealloc (pthread);
__pthread_dealloc_finish (pthread);
}
__pthread_setid (pthread->thread, NULL);
atomic_fetch_add_relaxed (&__pthread_total, -1);
failed_sigstate:
__pthread_sigstate_destroy (pthread);
failed_setup:
_dl_deallocate_tls (pthread->tcb, 1);
pthread->tcb = NULL;
failed_thread_tls_alloc:
__pthread_thread_terminate (pthread);
/* __pthread_thread_terminate has taken care of deallocating the stack and
the thread structure. */
goto failed;
failed_thread_alloc:
if (pthread->stack)
__pthread_stack_dealloc (pthread->stackaddr,
((setup->__guardsize + __vm_page_size - 1)
/ __vm_page_size) * __vm_page_size + stacksize);
failed_stack_alloc:
__pthread_dealloc (pthread);
__pthread_dealloc_finish (pthread);
failed:
return err;
}