summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-14 15:53:25 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-05-14 15:53:25 +0100
commit1a21511cf971981c6c94e6ae4f8f8e34f1a83b1a (patch)
tree6f5409568eccb0dc1c4878feae7620918b80f65f /src
parent60c516af8d40ccbefec3594e50cbbe567eee1200 (diff)
downloadrspamd-1a21511cf971981c6c94e6ae4f8f8e34f1a83b1a.tar.gz
rspamd-1a21511cf971981c6c94e6ae4f8f8e34f1a83b1a.zip
[Minor] Show bind line if available
Diffstat (limited to 'src')
-rw-r--r--src/libserver/cfg_file.h1
-rw-r--r--src/libserver/cfg_utils.c1
-rw-r--r--src/libserver/worker_util.c23
3 files changed, 20 insertions, 5 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index a12b16477..7a6cc1c8a 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -182,6 +182,7 @@ struct rspamd_worker_bind_conf {
GPtrArray *addrs;
guint cnt;
gchar *name;
+ const gchar *bind_line;
gboolean is_systemd;
struct rspamd_worker_bind_conf *next;
};
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 76de54e1b..ed9876b8d 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -81,6 +81,7 @@ rspamd_parse_bind_line (struct rspamd_config *cfg,
sizeof (struct rspamd_worker_bind_conf));
cnf->cnt = 1024;
+ cnf->bind_line = str;
if (g_ascii_strncasecmp (str, "systemd:", sizeof ("systemd:") - 1) == 0) {
/* The actual socket will be passed by systemd environment */
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index c041561f8..8c4e934bc 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -618,7 +618,7 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
event_reinit (rspamd_main->ev_base);
event_base_free (rspamd_main->ev_base);
- /* Drop privilleges */
+ /* Drop privileges */
rspamd_worker_drop_priv (rspamd_main);
/* Set limits */
rspamd_worker_set_limits (rspamd_main, cf);
@@ -628,7 +628,13 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
rlim.rlim_max = rlim.rlim_cur;
setrlimit (RLIMIT_STACK, &rlim);
- setproctitle ("%s process", cf->worker->name);
+ if (cf->bind_conf) {
+ setproctitle ("%s process (%s)", cf->worker->name,
+ cf->bind_conf->bind_line);
+ }
+ else {
+ setproctitle ("%s process", cf->worker->name);
+ }
if (rspamd_main->pfh) {
rspamd_pidfile_close (rspamd_main->pfh);
@@ -648,7 +654,7 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
wrk->start_time = rspamd_get_calendar_ticks ();
#if ((GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION <= 30))
-# if (GLIB_MINOR_VERSION > 20)
+ # if (GLIB_MINOR_VERSION > 20)
/* Ugly hack for old glib */
if (!g_thread_get_initialized ()) {
g_thread_init (NULL);
@@ -657,8 +663,15 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
g_thread_init (NULL);
# endif
#endif
- msg_info_main ("starting %s process %P (%d)", cf->worker->name,
- getpid (), index);
+ if (cf->bind_conf) {
+ msg_info_main ("starting %s process %P (%d); listen on: %s",
+ cf->worker->name,
+ getpid (), index, cf->bind_conf->bind_line);
+ }
+ else {
+ msg_info_main ("starting %s process %P (%d)", cf->worker->name,
+ getpid (), index);
+ }
/* Close parent part of socketpair */
close (wrk->control_pipe[0]);
close (wrk->srv_pipe[0]);