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
This commit is contained in:
Maxim Konovalov 2006-06-09 14:23:40 +00:00
parent 8ef09875f0
commit 0295184c7e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159462
6 changed files with 36 additions and 14 deletions

View File

@ -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 */

View File

@ -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.
*

View File

@ -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;

View File

@ -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 */

View File

@ -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.
*

View File

@ -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;