diff options
author | davidxu <davidxu@FreeBSD.org> | 2003-08-10 22:35:46 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2003-08-10 22:35:46 +0000 |
commit | 09416455b19e2f92a8958f72868349089319992a (patch) | |
tree | 9f23133d793046fcc248d3dce7bd6c76af842269 /lib/libkse/thread/thr_sig.c | |
parent | 4d41804986579927b11b034be46979d4110e0452 (diff) | |
download | FreeBSD-src-09416455b19e2f92a8958f72868349089319992a.zip FreeBSD-src-09416455b19e2f92a8958f72868349089319992a.tar.gz |
Add some quick pathes to exit process when signal action is default and
signal can causes process to exit.
Reviewed by: deischen
Diffstat (limited to 'lib/libkse/thread/thr_sig.c')
-rw-r--r-- | lib/libkse/thread/thr_sig.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c index 782e3e7..3c68212 100644 --- a/lib/libkse/thread/thr_sig.c +++ b/lib/libkse/thread/thr_sig.c @@ -820,11 +820,13 @@ _thr_sig_add(struct pthread *pthread, int sig, siginfo_t *info) int restart; int suppress_handler = 0; int fromproc = 0; + __sighandler_t *sigfunc; DBG_MSG(">>> _thr_sig_add %p (%d)\n", pthread, sig); curkse = _get_curkse(); restart = _thread_sigact[sig - 1].sa_flags & SA_RESTART; + sigfunc = _thread_sigact[sig - 1].sa_handler; fromproc = (curthread == _thr_sig_daemon); if (pthread->state == PS_DEAD || pthread->state == PS_DEADLOCK || @@ -855,6 +857,11 @@ _thr_sig_add(struct pthread *pthread, int sig, siginfo_t *info) SIGADDSET(pthread->sigpend, sig); } if (!SIGISMEMBER(pthread->sigmask, sig)) { + /* A quick path to exit process */ + if (sigfunc == SIG_DFL && sigprop(sig) & SA_KILL) { + kse_thr_interrupt(NULL, KSE_INTR_SIGEXIT, sig); + /* Never reach */ + } pthread->check_pending = 1; if (!(pthread->attr.flags & PTHREAD_SCOPE_SYSTEM) && (pthread->blocked != 0) && @@ -870,6 +877,13 @@ _thr_sig_add(struct pthread *pthread, int sig, siginfo_t *info) return (NULL); info = &siginfo; } + + if (pthread->state != PS_SIGWAIT && sigfunc == SIG_DFL && + (sigprop(sig) & SA_KILL)) { + kse_thr_interrupt(NULL, KSE_INTR_SIGEXIT, sig); + /* Never reach */ + } + /* * Process according to thread state: */ @@ -941,6 +955,13 @@ _thr_sig_add(struct pthread *pthread, int sig, siginfo_t *info) /* Increment the pending signal count. */ SIGADDSET(pthread->sigpend, sig); if (!SIGISMEMBER(pthread->sigmask, sig)) { + if (sigfunc == SIG_DFL && + sigprop(sig) & SA_KILL) { + kse_thr_interrupt(NULL, + KSE_INTR_SIGEXIT, + sig); + /* Never reach */ + } pthread->check_pending = 1; pthread->interrupted = 1; kmbx = _thr_setrunnable_unlocked(pthread); |