]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Show bind line if available
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 May 2018 14:53:25 +0000 (15:53 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 May 2018 14:53:25 +0000 (15:53 +0100)
src/libserver/cfg_file.h
src/libserver/cfg_utils.c
src/libserver/worker_util.c

index a12b1647727acafc539fedd93edf0b523ca6a04b..7a6cc1c8a5a9e353139afb6138c8dcbc9c5aca42 100644 (file)
@@ -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;
 };
index 76de54e1bfecb92b0a08f26f46ca32bd785148bd..ed9876b8d43a72d927eba5d386398d3547afacb4 100644 (file)
@@ -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 */
index c041561f890b43e53966d6b49db1d6c1d4ee7695..8c4e934bc9367673f51910dd15f5fdc2d33a570b 100644 (file)
@@ -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]);