summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authormaxim <maxim@FreeBSD.org>2006-06-09 14:23:40 +0000
committermaxim <maxim@FreeBSD.org>2006-06-09 14:23:40 +0000
commit7b9c5e1df6503fe2de55b89754f8cf3cf2a1735a (patch)
tree4cc59b7fbcf327d22eafb5278b6b45f6ad0a4b52 /lib/libpthread
parentf39caee822f1504e4b901a537c04cece488995a1 (diff)
downloadFreeBSD-src-7b9c5e1df6503fe2de55b89754f8cf3cf2a1735a.zip
FreeBSD-src-7b9c5e1df6503fe2de55b89754f8cf3cf2a1735a.tar.gz
o Remove a cruft prevented libpthread sigaction(2) wrapper to
do its work for SIGINFO. Always install libpthread signal handler wrapper for SIGINFO even if user SIG_IGN's or SIG_DFL's it. SIGINFO has a special meaning for libpthread: when LIBPTHREAD_DEBUG enviroment variable defined it is used for dumping an information about threads to /tmp/. Reported by: mi Reviewed by: deischen MFC after: 2 weeks
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_private.h7
-rw-r--r--lib/libpthread/thread/thr_sig.c6
-rw-r--r--lib/libpthread/thread/thr_sigaction.c12
3 files changed, 18 insertions, 7 deletions
diff --git a/lib/libpthread/thread/thr_private.h b/lib/libpthread/thread/thr_private.h
index f839960..927e9d1 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 f53b87f..116f9f6 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 7ee0ce6..bc54a86 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;
OpenPOWER on IntegriCloud