From: Andrew Bartlett Date: Fri, 21 Feb 2020 20:45:39 +0000 (+1300) Subject: lib/tfork: Improve process titles for the tfork waiter process X-Git-Tag: ldb-2.2.0~1569 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f50bd0d0509d20cd7b689bf366897ed8800e2435;p=thirdparty%2Fsamba.git lib/tfork: Improve process titles for the tfork waiter process 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 Reviewed-by: Gary Lockyer --- diff --git a/lib/util/tfork.c b/lib/util/tfork.c index 16ea002b87c..5a5d449ecf8 100644 --- a/lib/util/tfork.c +++ b/lib/util/tfork.c @@ -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 @@ -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);