Fixed signal handler debug messages
This commit is contained in:
parent
1131f69733
commit
48635357cb
1 changed files with 17 additions and 2 deletions
|
@ -411,12 +411,24 @@ void Util::Config::activate() {
|
||||||
/// a SIGINT, SIGHUP or SIGTERM signal, reaps children for the SIGCHLD
|
/// a SIGINT, SIGHUP or SIGTERM signal, reaps children for the SIGCHLD
|
||||||
/// signal, and ignores all other signals.
|
/// signal, and ignores all other signals.
|
||||||
void Util::Config::signal_handler(int signum, siginfo_t * sigInfo, void * ignore) {
|
void Util::Config::signal_handler(int signum, siginfo_t * sigInfo, void * ignore) {
|
||||||
HIGH_MSG("Received signal %s (%d) from process %d", strsignal(signum), signum, sigInfo->si_pid);
|
|
||||||
switch (signum) {
|
switch (signum) {
|
||||||
case SIGINT: //these three signals will set is_active to false.
|
case SIGINT: //these three signals will set is_active to false.
|
||||||
case SIGHUP:
|
case SIGHUP:
|
||||||
case SIGTERM:
|
case SIGTERM:
|
||||||
is_active = false;
|
is_active = false;
|
||||||
|
default:
|
||||||
|
switch (sigInfo->si_code){
|
||||||
|
case SI_USER:
|
||||||
|
case SI_QUEUE:
|
||||||
|
case SI_TIMER:
|
||||||
|
case SI_ASYNCIO:
|
||||||
|
case SI_MESGQ:
|
||||||
|
INFO_MSG("Received signal %s (%d) from process %d", strsignal(signum), signum, sigInfo->si_pid);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
INFO_MSG("Received signal %s (%d)", strsignal(signum), signum);
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SIGCHLD: { //when a child dies, reap it.
|
case SIGCHLD: { //when a child dies, reap it.
|
||||||
int status;
|
int status;
|
||||||
|
@ -427,9 +439,12 @@ void Util::Config::signal_handler(int signum, siginfo_t * sigInfo, void * ignore
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
HIGH_MSG("Received signal %s (%d) from process %d", strsignal(signum), signum, sigInfo->si_pid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: //other signals are ignored
|
case SIGPIPE:
|
||||||
|
//We ignore SIGPIPE to prevent messages triggering another SIGPIPE.
|
||||||
|
//Loops are bad, m'kay?
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} //signal_handler
|
} //signal_handler
|
||||||
|
|
Loading…
Add table
Reference in a new issue