aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-05 18:09:54 +0300
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2009-11-05 18:09:54 +0300
commit9b6b141a936bb7ba89c431176fa53a5878b8a9bd (patch)
treebfe875c900f2e865ece4d00f223b7529a86dc625 /src/util.c
parentd78ac2d1060c2b049b4eebc176d3823f82f9ea76 (diff)
downloadrspamd-9b6b141a936bb7ba89c431176fa53a5878b8a9bd.tar.gz
rspamd-9b6b141a936bb7ba89c431176fa53a5878b8a9bd.zip
* Add more advanced signal processing routine
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index fbb5cb547..425aed439 100644
--- a/src/util.c
+++ b/src/util.c
@@ -305,8 +305,13 @@ write_pid (struct rspamd_main *main)
return 0;
}
+#ifdef HAVE_SA_SIGINFO
void
-init_signals (struct sigaction *signals, sig_t sig_handler)
+init_signals (struct sigaction *signals, void (*sig_handler)(int, siginfo_t *, void *))
+#else
+void
+init_signals (struct sigaction *signals, sighandler_t sig_handler)
+#endif
{
struct sigaction sigpipe_act;
/* Setting up signal handlers */
@@ -322,8 +327,14 @@ init_signals (struct sigaction *signals, sig_t sig_handler)
sigaddset (&signals->sa_mask, SIGALRM);
+#ifdef HAVE_SA_SIGINFO
+ signals->sa_flags = SA_SIGINFO;
+ signals->sa_handler = NULL;
+ signals->sa_sigaction = sig_handler;
+#else
signals->sa_handler = sig_handler;
signals->sa_flags = 0;
+#endif
sigaction (SIGTERM, signals, NULL);
sigaction (SIGINT, signals, NULL);
sigaction (SIGHUP, signals, NULL);