From: Vsevolod Stakhov Date: Mon, 14 May 2018 14:53:25 +0000 (+0100) Subject: [Minor] Show bind line if available X-Git-Tag: 1.7.5~30 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1a21511cf971981c6c94e6ae4f8f8e34f1a83b1a;p=rspamd.git [Minor] Show bind line if available --- 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]);