Commit 801f115f28ebaabda2311d26fe88afe4d055512f
1 parent
c6635e39
simply copy signal handling code from gameserver project
Showing
2 changed files
with
38 additions
and
0 deletions
include/signalHandling.h
0 → 100644
src/signalHandling.c
0 → 100644
1 | +#include <signal.h> /* for signal() and signal names */ | |
2 | + | |
3 | +#include "include/monitor.h" | |
4 | + | |
5 | +volatile int doShutdown; | |
6 | + | |
7 | +void terminate(int signum) | |
8 | +{ | |
9 | + signal(signum, SIG_IGN); | |
10 | + syslogMonitor(LOG_INFO, MON_CRITICAL, "signals", | |
11 | + "caugth deadly signal %d", signum); | |
12 | + syslogMonitor(LOG_INFO, MON_FAILURE, "signals", | |
13 | + "caugth deadly signal %d - service terminated", signum); | |
14 | + doShutdown = 1; | |
15 | +} | |
16 | + | |
17 | +void init_signals(void) | |
18 | +{ | |
19 | + signal(SIGTERM, terminate); | |
20 | + signal(SIGHUP, SIG_IGN); | |
21 | + signal(SIGINT, terminate); | |
22 | + signal(SIGQUIT, terminate); | |
23 | + signal(SIGABRT, terminate); | |
24 | + signal(SIGALRM, SIG_IGN); | |
25 | + signal(SIGURG, SIG_IGN); | |
26 | + | |
27 | + signal(SIGPIPE, SIG_IGN); | |
28 | +} | ... | ... |
Please
register
or
login
to post a comment