aboutsummaryrefslogtreecommitdiff
path: root/lib/libkse/thread/thr_sig.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libkse/thread/thr_sig.c')
-rw-r--r--lib/libkse/thread/thr_sig.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/lib/libkse/thread/thr_sig.c b/lib/libkse/thread/thr_sig.c
index ec6ebd51eadd..f53b87f08b17 100644
--- a/lib/libkse/thread/thr_sig.c
+++ b/lib/libkse/thread/thr_sig.c
@@ -98,6 +98,12 @@ 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.
*
@@ -253,7 +259,7 @@ _thr_sig_dispatch(struct kse *curkse, int sig, siginfo_t *info)
DBG_MSG(">>> _thr_sig_dispatch(%d)\n", sig);
/* Check if the signal requires a dump of thread information: */
- if (sig == SIGINFO) {
+ if (_thr_dump_enabled() && (sig == SIGINFO)) {
/* Dump thread information to file: */
_thread_dump_info();
}
@@ -347,7 +353,7 @@ _thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
}
/* Check if the signal requires a dump of thread information: */
- if (sig == SIGINFO) {
+ if (_thr_dump_enabled() && (sig == SIGINFO)) {
/* Dump thread information to file: */
_thread_dump_info();
}
@@ -521,7 +527,7 @@ handle_signal(struct pthread *curthread, struct sighandle_info *shi)
_kse_critical_leave(&curthread->tcb->tcb_tmbx);
/* Check if the signal requires a dump of thread information: */
- if (shi->sig == SIGINFO) {
+ if (_thr_dump_enabled() && (shi->sig == SIGINFO)) {
/* Dump thread information to file: */
_thread_dump_info();
}
@@ -1200,21 +1206,24 @@ _thr_signal_init(void)
__sys_sigaction(i, &act, NULL);
}
}
- /*
- * Install the signal handler for SIGINFO. It isn't
- * really needed, but it is nice to have for debugging
- * purposes.
- */
- _thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
- SIGEMPTYSET(act.sa_mask);
- act.sa_flags = SA_SIGINFO | SA_RESTART;
- act.sa_sigaction = (__siginfohandler_t *)&_thr_sig_handler;
- if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
- __sys_sigprocmask(SIG_SETMASK, &_thr_initial->sigmask, NULL);
+ if (_thr_dump_enabled()) {
/*
- * Abort this process if signal initialisation fails:
+ * Install the signal handler for SIGINFO. It isn't
+ * really needed, but it is nice to have for debugging
+ * purposes.
*/
- PANIC("Cannot initialize signal handler");
+ _thread_sigact[SIGINFO - 1].sa_flags = SA_SIGINFO | SA_RESTART;
+ SIGEMPTYSET(act.sa_mask);
+ act.sa_flags = SA_SIGINFO | SA_RESTART;
+ act.sa_sigaction = (__siginfohandler_t *)&_thr_sig_handler;
+ if (__sys_sigaction(SIGINFO, &act, NULL) != 0) {
+ __sys_sigprocmask(SIG_SETMASK, &_thr_initial->sigmask,
+ NULL);
+ /*
+ * Abort this process if signal initialisation fails:
+ */
+ PANIC("Cannot initialize signal handler");
+ }
}
__sys_sigprocmask(SIG_SETMASK, &_thr_initial->sigmask, NULL);
__sys_sigaltstack(NULL, &_thr_initial->sigstk);