aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 22:38:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-10-15 22:38:34 +0100
commitd48900e14e41e1b767af6f8461105d5239c3c93e (patch)
tree48d586a48c980c002fde3e64f2e9db729f46fb0d /src/libserver
parent665971625a939d5f8e5f41e99636f4e74ebca5d3 (diff)
downloadrspamd-d48900e14e41e1b767af6f8461105d5239c3c93e.tar.gz
rspamd-d48900e14e41e1b767af6f8461105d5239c3c93e.zip
Block signals when exiting event loop
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/worker_util.c14
-rw-r--r--src/libserver/worker_util.h5
2 files changed, 19 insertions, 0 deletions
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 5aff8883b..0e4a29a32 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -511,3 +511,17 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
return cur;
}
+
+void
+rspamd_worker_block_signals (void)
+{
+ sigset_t set;
+
+ sigemptyset (&set);
+ sigaddset (&set, SIGTERM);
+ sigaddset (&set, SIGINT);
+ sigaddset (&set, SIGHUP);
+ sigaddset (&set, SIGUSR1);
+ sigaddset (&set, SIGUSR2);
+ sigprocmask (SIG_BLOCK, &set, NULL);
+}
diff --git a/src/libserver/worker_util.h b/src/libserver/worker_util.h
index 30fbe904f..741180922 100644
--- a/src/libserver/worker_util.h
+++ b/src/libserver/worker_util.h
@@ -112,6 +112,11 @@ worker_t * rspamd_get_worker_by_type (struct rspamd_config *cfg, GQuark type);
void rspamd_worker_stop_accept (struct rspamd_worker *worker);
/**
+ * Block signals before terminations
+ */
+void rspamd_worker_block_signals (void);
+
+/**
* Fork new worker with the specified configuration
*/
struct rspamd_worker *rspamd_fork_worker (struct rspamd_main *,