diff options
author | julian <julian@FreeBSD.org> | 1998-02-13 01:27:34 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1998-02-13 01:27:34 +0000 |
commit | b31dde27bfeaed94b1026c0788c4e98b1af47f3c (patch) | |
tree | fc79071c0e7ec3b06afa547a18a7327d4c544935 /lib/libpthread/thread/thr_kern.c | |
parent | b28763a6b13c1f0830c84238266c8ad69f7455bd (diff) | |
download | FreeBSD-src-b31dde27bfeaed94b1026c0788c4e98b1af47f3c.zip FreeBSD-src-b31dde27bfeaed94b1026c0788c4e98b1af47f3c.tar.gz |
Fixes from Jeremy Allison and Terry Lambert for pthreads:
specifically:
uthread_accept.c: Fix for inherited socket not getting correct entry in
pthread flags.
uthread_create.c: Fix to allow pthread_t pointer return to be null if
caller doesn't care about return.
uthread_fd.c: Fix for return codes to be placed into correct errno.
uthread_init.c: Changes to make gcc-2.8 thread aware for exception stack
frames (WARNING: This is #ifdef'ed out by default and is
different from the Cygnus egcs fix).
uthread_ioctl.c: Fix for blocking/non-blocking ioctl.
uthread_kern.c: Signal handling fixes (only one case left to fix,
that of an externally sent SIGSEGV and friends -
a fairly unusual case).
uthread_write.c: Fix for lock of fd - ask for write lock, not read/write.
uthread_writev.c: Fix for lock of fd - ask for write lock, not read/write.
Pthreads now works well enough to run the LDAP and ACAPD(with the gcc 2.8 fix)
sample implementations.
Diffstat (limited to 'lib/libpthread/thread/thr_kern.c')
-rw-r--r-- | lib/libpthread/thread/thr_kern.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/lib/libpthread/thread/thr_kern.c b/lib/libpthread/thread/thr_kern.c index ba8e250..925d5bf 100644 --- a/lib/libpthread/thread/thr_kern.c +++ b/lib/libpthread/thread/thr_kern.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: uthread_kern.c,v 1.5 1997/04/01 22:51:48 jb Exp $ * */ #include <errno.h> @@ -949,6 +949,58 @@ _thread_signal(pthread_t pthread, int sig) _thread_sys_sigreturn(&pthread->saved_sigcontext); break; + /* + * The following signals should terminate the + * process. Do this by clearing the signal action + * and then re-throwing the signal. + */ + case SIGHUP: + case SIGINT: + case SIGPIPE: + case SIGALRM: + case SIGTERM: + case SIGXCPU: + case SIGXFSZ: + case SIGVTALRM: + case SIGUSR1: + case SIGUSR2: + /* These signals stop the process. Also re-throw them. */ + case SIGTSTP: + case SIGTTIN: + case SIGTTOU: + /* Clear the signal action: */ + sigfillset(&act.sa_mask); + act.sa_handler = SIG_DFL; + act.sa_flags = SA_RESTART; + _thread_sys_sigaction(sig, &act, NULL); + /* Re-throw to ourselves. */ + kill(getpid(), sig); + break; + + case SIGCONT: + /* + * If we get this it means that we were + * probably stopped and then continued. + * Reset the handler for the SIGTSTP, SIGTTIN + * and SIGTTOU signals. + */ + + sigfillset(&act.sa_mask); + act.sa_handler = (void (*) ()) _thread_sig_handler; + act.sa_flags = SA_RESTART; + + /* Initialise the signals for default handling: */ + if (_thread_sys_sigaction(SIGTSTP, &act, NULL) != 0) { + PANIC("Cannot initialise SIGTSTP signal handler"); + } + if (_thread_sys_sigaction(SIGTTIN, &act, NULL) != 0) { + PANIC("Cannot initialise SIGTTIN signal handler"); + } + if (_thread_sys_sigaction(SIGTTOU, &act, NULL) != 0) { + PANIC("Cannot initialise SIGTTOU signal handler"); + } + break; + /* Default processing for other signals: */ default: /* |