<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libpthread/thread/thr_sig.c, branch releng/6.2</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>MFC rev. 1.127 thr_private.h, rev. 1.85 thr_sig.c, rev. 1.24 thr_sigaction.c:</title>
<updated>2006-06-23T10:51:36+00:00</updated>
<author>
<name>Maxim Konovalov</name>
<email>maxim@FreeBSD.org</email>
</author>
<published>2006-06-23T10:51:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5e58a056dcabf16adf41807ff14691913f3c2d58'/>
<id>5e58a056dcabf16adf41807ff14691913f3c2d58</id>
<content type='text'>
make signal(SIGINFO, handler) work for libpthread.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
make signal(SIGINFO, handler) work for libpthread.
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC: Relevent commit logs are below.</title>
<updated>2006-03-16T23:29:08+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2006-03-16T23:29:08+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=40837c5215e9e4c23b101a3189cd6c208d173e0c'/>
<id>40837c5215e9e4c23b101a3189cd6c208d173e0c</id>
<content type='text'>
  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-&gt;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 &lt;pthread.h&gt;.  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 &lt;string.h&gt;
  o  Make this ILP32/LP64 clean: cast pointers to long.

Approved by:	re (scottl)
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
  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-&gt;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 &lt;pthread.h&gt;.  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 &lt;string.h&gt;
  o  Make this ILP32/LP64 clean: cast pointers to long.

Approved by:	re (scottl)
</pre>
</div>
</content>
</entry>
<entry>
<title>Use a generic way to back threads out of wait queues when handling</title>
<updated>2004-12-18T18:07:37+00:00</updated>
<author>
<name>Daniel Eischen</name>
<email>deischen@FreeBSD.org</email>
</author>
<published>2004-12-18T18:07:37+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=843d4004b367db61428fa1cbf611cdbd2791d672'/>
<id>843d4004b367db61428fa1cbf611cdbd2791d672</id>
<content type='text'>
signals instead of having more intricate knowledge of thread state
within signal handling.

Simplify signal code because of above (by David Xu).

Use macros for libpthread usage of pthread_cleanup_push() and
pthread_cleanup_pop().  This removes some instances of malloc()
and free() from the semaphore and pthread_once() implementations.

When single threaded and forking(), make sure that the current
thread's signal mask is inherited by the forked thread.

Use private mutexes for libc and libpthread.  Signals are
deferred while threads hold private mutexes.  This fix also
breaks www/linuxpluginwrapper; a patch that fixes it is at
http://people.freebsd.org/~deischen/kse/linuxpluginwrapper.diff

Fix race condition in condition variables where handling a
signal (pthread_kill() or kill()) may not see a wakeup
(pthread_cond_signal() or pthread_cond_broadcast()).

In collaboration with:	davidxu
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
signals instead of having more intricate knowledge of thread state
within signal handling.

Simplify signal code because of above (by David Xu).

Use macros for libpthread usage of pthread_cleanup_push() and
pthread_cleanup_pop().  This removes some instances of malloc()
and free() from the semaphore and pthread_once() implementations.

When single threaded and forking(), make sure that the current
thread's signal mask is inherited by the forked thread.

Use private mutexes for libc and libpthread.  Signals are
deferred while threads hold private mutexes.  This fix also
breaks www/linuxpluginwrapper; a patch that fixes it is at
http://people.freebsd.org/~deischen/kse/linuxpluginwrapper.diff

Fix race condition in condition variables where handling a
signal (pthread_kill() or kill()) may not see a wakeup
(pthread_cond_signal() or pthread_cond_broadcast()).

In collaboration with:	davidxu
</pre>
</div>
</content>
</entry>
<entry>
<title>Save cancelflags in signal frame, this fixes a problem that</title>
<updated>2004-11-01T10:49:34+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-11-01T10:49:34+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=4dd715ced2c947807f69cfdb2dab716bf0731962'/>
<id>4dd715ced2c947807f69cfdb2dab716bf0731962</id>
<content type='text'>
a thread in pthread_cond_wait handled a signal can no longer
be canceled.

Reviewed by: deischen
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
a thread in pthread_cond_wait handled a signal can no longer
be canceled.

Reviewed by: deischen
</pre>
</div>
</content>
</entry>
<entry>
<title>1. Move thread list flags into new separate member, and atomically</title>
<updated>2004-10-23T23:28:36+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-10-23T23:28:36+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b4f9f84b962fcd8c899067dbfa2976254213d9df'/>
<id>b4f9f84b962fcd8c899067dbfa2976254213d9df</id>
<content type='text'>
   put DEAD thread on GC list, this closes a race between pthread_join
   and thr_cleanup.
2. Introduce a mutex to protect tcb initialization, tls allocation and
   deallocation code in rtld seems no lock protection or it is broken,
   under stress testing, memory is corrupted.

Reviewed by: deischen
patch partly provided by: deischen
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
   put DEAD thread on GC list, this closes a race between pthread_join
   and thr_cleanup.
2. Introduce a mutex to protect tcb initialization, tls allocation and
   deallocation code in rtld seems no lock protection or it is broken,
   under stress testing, memory is corrupted.

Reviewed by: deischen
patch partly provided by: deischen
</pre>
</div>
</content>
</entry>
<entry>
<title>Decrease reference count if we won't use the thread, this avoids memory</title>
<updated>2004-10-21T03:42:24+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-10-21T03:42:24+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=39454d368fe5970ee9eb90bd322b28820dd61841'/>
<id>39454d368fe5970ee9eb90bd322b28820dd61841</id>
<content type='text'>
leak under some cases.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
leak under some cases.
</pre>
</div>
</content>
</entry>
<entry>
<title>Let debugger check signal, make SIGINFO works.</title>
<updated>2004-07-13T22:52:11+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-07-13T22:52:11+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=c7f5b2dbc5571635c3ff2d44ef733beddda88e8f'/>
<id>c7f5b2dbc5571635c3ff2d44ef733beddda88e8f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Check pending signals, if there is signal will be unblocked by</title>
<updated>2004-06-12T07:40:01+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-06-12T07:40:01+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=5321c2a9b02e061e8f5afe4538634523e9e37927'/>
<id>5321c2a9b02e061e8f5afe4538634523e9e37927</id>
<content type='text'>
sigsuspend, thread shouldn't wait, in old code, it may be
ignored.
When a signal handler is invoked in sigsuspend, thread gets
two different signal masks, one is in thread structure,
sigprocmask() can retrieve it, another is in ucontext
which is a third parameter of signal handler, the former is
the result of sigsuspend mask ORed with sigaction's sa_mask
and current signal, the later is the mask in thread structure
before sigsuspend is called. After signal handler is called,
the mask in ucontext should be copied into thread structure,
and becomes CURRENT signal mask, then sigsuspend returns to
user code.

Reviewed by: deischen
Tested by: Sean McNeil &lt;sean@mcneil.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sigsuspend, thread shouldn't wait, in old code, it may be
ignored.
When a signal handler is invoked in sigsuspend, thread gets
two different signal masks, one is in thread structure,
sigprocmask() can retrieve it, another is in ucontext
which is a third parameter of signal handler, the former is
the result of sigsuspend mask ORed with sigaction's sa_mask
and current signal, the later is the mask in thread structure
before sigsuspend is called. After signal handler is called,
the mask in ucontext should be copied into thread structure,
and becomes CURRENT signal mask, then sigsuspend returns to
user code.

Reviewed by: deischen
Tested by: Sean McNeil &lt;sean@mcneil.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Kernel now supports per-thread sigaltstack, follow the change to</title>
<updated>2004-01-03T02:40:27+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-01-03T02:40:27+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=7a29c72c0705d8a1f89efff2fbaffd921ba63da8'/>
<id>7a29c72c0705d8a1f89efff2fbaffd921ba63da8</id>
<content type='text'>
enable sigaltstack for scope system thread.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
enable sigaltstack for scope system thread.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix a typo.</title>
<updated>2004-01-02T00:27:30+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2004-01-02T00:27:30+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=f9091138193b3281168c7bf955ef010a0e6fe947'/>
<id>f9091138193b3281168c7bf955ef010a0e6fe947</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
</feed>
