Only catch SIGINFO (for dumping thread states) when LIBPTHREAD_DEBUG
is defined in the environment.
Modify the code path of the ifdef NOTYET part of _kse_single_thread():
o Don't reinitialise the atfork() handler list in the child. We
are meant to call the child handler, and on subsequent fork()s
should call all three functions as normal.
o Don't reinitialise the thread specific keyed data in the
child after a fork. Applications may require this for context.
o Reinitialise curthread->tlflags after removing ourselves from
(and reinitialising) the various internal thread lists.
o Reinitialise __malloc_lock in the child after fork() (to balance
our explicitly taking the lock prior to the fork()).
With these changes, it is possible to enable the NOTYET code in
thr_kern.c to allow the use of non-async-safe functions after
fork()ing from a threaded program.
Eliminate a race condition in timed waits (cv, mutex, and sleeps).
Don't forget to initialize a tailq before using it.
For the ``#ifdef NOTYET'' code that allows calling non-async-safe
functions in the child after a fork() from a threaded process,
use __sys_setprocmask() rather than setprocmask() to keep our
signal handling sane. Without this fix, signals are essentially
ignored in said child and things such as protection violations
result in an endless busy loop.
Allocate a thread's tcb last so it is easier to handle failures to
malloc() siginfo.
Include needed headers that were obtained through <pthread.h>. Sort headers
while here.
amd64
-----
Fix a race condition introduced when redzones were added. Use an
atomic operation to return and adjust the stack (amd64).
test
-----
o Include <string.h>
o Make this ILP32/LP64 clean: cast pointers to long.
Approved by: re (scottl)