]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
lib/tfork: Improve process titles for the tfork waiter process
authorAndrew Bartlett <abartlet@samba.org>
Fri, 21 Feb 2020 20:45:39 +0000 (09:45 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 27 Feb 2020 03:42:35 +0000 (03:42 +0000)
This makes it easier to understand the process graph as there is
not a duplicate (eg) ldap[master] process for each tfork waiter.
when useing "ps -ef -o pid,comm"

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14287

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/util/tfork.c

index 16ea002b87c49885d1e9e93cad7daed79a4db635..5a5d449ecf81153419ba4b61b5e5ba9fdbf3f5cb 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/util/sys_rw.h"
 #include "lib/util/tfork.h"
 #include "lib/util/debug.h"
+#include "lib/util/util_process.h"
 
 #ifdef HAVE_PTHREAD
 #include <pthread.h>
@@ -572,6 +573,7 @@ static pid_t tfork_start_waiter_and_worker(struct tfork_state *state,
         * The "waiter" child.
         */
        setproctitle("tfork waiter process");
+       prctl_set_comment("tfork waiter");
        CatchSignal(SIGCHLD, SIG_DFL);
 
        close(status_sp_caller_fd);
@@ -603,6 +605,8 @@ static pid_t tfork_start_waiter_and_worker(struct tfork_state *state,
                return 0;
        }
        state->worker_pid = pid;
+       setproctitle("tfork waiter process(%d)", pid);
+       prctl_set_comment("tfork(%d)", pid);
 
        close(ready_pipe_worker_fd);