From: Ralph Boehme Date: Fri, 2 Dec 2022 08:49:11 +0000 (+0100) Subject: smbd: set long process name of smbd child processes to "smbd: " X-Git-Tag: talloc-2.4.0~258 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5955dc1e4fde7c1335cae5c7fd9bef71fd3fab3c;p=thirdparty%2Fsamba.git smbd: set long process name of smbd child processes to "smbd: " The resulting process listings, depending on the format chosen for the process name, show the relevant smbd processes like this: $ ps faxo pid,uid,comm | egrep "\_.*smbd" | grep -v grep 1690322 0 \_ smbd 1690326 0 \_ smbd-notifyd 1690327 0 \_ smbd-cleanupd 1690337 0 \_ smbd[::1] $ ps faxo pid,uid,args | egrep "\_.*smbd" | grep -v grep 1690322 0 \_ ./bin/smbd -D 1690326 0 \_ smbd: notifyd 1690327 0 \_ smbd: cleanupd 1690337 0 \_ smbd: client [::1] Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Dec 14 02:47:24 UTC 2022 on sn-devel-184 --- diff --git a/source3/smbd/server.c b/source3/smbd/server.c index b1c9e219e16..155d2207609 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -35,6 +35,7 @@ #include "secrets.h" #include "../lib/util/memcache.h" #include "ctdbd_conn.h" +#include "lib/util/util_process.h" #include "util_cluster.h" #include "printing/queue_process.h" #include "rpc_server/rpc_config.h" @@ -1001,6 +1002,7 @@ static void smbd_accept_connection(struct tevent_context *ev, pid = fork(); if (pid == 0) { + char addrstr[INET6_ADDRSTRLEN]; NTSTATUS status = NT_STATUS_OK; /* @@ -1038,6 +1040,9 @@ static void smbd_accept_connection(struct tevent_context *ev, smb_panic("reinit_after_fork() failed"); } + print_sockaddr(addrstr, sizeof(addrstr), &addr); + process_set_title("smbd[%s]", "client [%s]", addrstr); + smbd_process(ev, msg_ctx, fd, false); exit: exit_server_cleanly("end of child");