diff options
| author | Maxim Konovalov <maxim@FreeBSD.org> | 2006-06-09 14:23:40 +0000 |
|---|---|---|
| committer | Maxim Konovalov <maxim@FreeBSD.org> | 2006-06-09 14:23:40 +0000 |
| commit | 0295184c7e77df0e56f06096b4280a4cc6064b58 (patch) | |
| tree | 4cc59b7fbcf327d22eafb5278b6b45f6ad0a4b52 /lib/libpthread/thread | |
| parent | 8ef09875f098d8b2daecf2bcf042cd648cf6ef6f (diff) | |
Notes
Diffstat (limited to 'lib/libpthread/thread')
| -rw-r--r-- | lib/libpthread/thread/thr_private.h | 7 | ||||
| -rw-r--r-- | lib/libpthread/thread/thr_sig.c | 6 | ||||
| -rw-r--r-- | lib/libpthread/thread/thr_sigaction.c | 12 |
3 files changed, 18 insertions, 7 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h index f83996074060..927e9d1f3f5c 100644 --- a/lib/libpthread/thread/thr_private.h +++ b/lib/libpthread/thread/thr_private.h @@ -1317,4 +1317,11 @@ int __sys_poll(struct pollfd *, unsigned, int); int __sys_msync(void *, size_t, int); #endif +static __inline int +_thr_dump_enabled(void) +{ + + return ((_thr_debug_flags & DBG_INFO_DUMP) != 0); +} + #endif /* !_THR_PRIVATE_H */ diff --git a/lib/libpthread/thread/thr_sig.c b/lib/libpthread/thread/thr_sig.c index f53b87f08b17..116f9f6b9bf6 100644 --- a/lib/libpthread/thread/thr_sig.c +++ b/lib/libpthread/thread/thr_sig.c @@ -98,12 +98,6 @@ static int sigproptbl[NSIG] = { #define DBG_MSG(x...) #endif -static __inline int -_thr_dump_enabled(void) -{ - return ((_thr_debug_flags & DBG_INFO_DUMP) != 0); -} - /* * Signal setup and delivery. * diff --git a/lib/libpthread/thread/thr_sigaction.c b/lib/libpthread/thread/thr_sigaction.c index 7ee0ce616904..bc54a869e15c 100644 --- a/lib/libpthread/thread/thr_sigaction.c +++ b/lib/libpthread/thread/thr_sigaction.c @@ -75,7 +75,7 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact) * Check if the kernel needs to be advised of a change * in signal action: */ - if (act != NULL && sig != SIGINFO) { + if (act != NULL) { newact.sa_flags |= SA_SIGINFO; @@ -91,6 +91,16 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact) */ newact.sa_handler = (void (*) ())_thr_sig_handler; } + /* + * Install libpthread signal handler wrapper + * for SIGINFO signal if threads dump enabled + * even if a user set the signal handler to + * SIG_DFL or SIG_IGN. + */ + if (sig == SIGINFO && _thr_dump_enabled()) { + newact.sa_handler = + (void (*) ())_thr_sig_handler; + } /* Change the signal action in the kernel: */ if (__sys_sigaction(sig, &newact, NULL) != 0) { _thread_sigact[sig - 1] = oldact; |
