Skip to content

Commit

Permalink
smbd: set long process name of smbd child processes to "smbd: <CLIENT…
Browse files Browse the repository at this point in the history
… IP>"

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 <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>

Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Wed Dec 14 02:47:24 UTC 2022 on sn-devel-184
  • Loading branch information
slowfranklin authored and jrasamba committed Dec 14, 2022
1 parent fc57b88 commit 5955dc1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions source3/smbd/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;

/*
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 5955dc1

Please sign in to comment.