mirror of
https://github.com/samba-team/samba.git
synced 2025-01-21 18:04:06 +03:00
s4-smbd: Make use of prctl_set_comment()
This makes it possible to tell different child tasks apart on linux systems that have not compiled against libsetproctitle or libbsd-setproctitle. Use "ps -ef -o pid,comm" to see the tree with these titles. 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>
This commit is contained in:
parent
efb3aa95c5
commit
3136d2fd95
@ -44,6 +44,7 @@
|
||||
#include "ldb_wrap.h"
|
||||
#include "lib/util/tfork.h"
|
||||
#include "lib/messaging/irpc.h"
|
||||
#include "lib/util/util_process.h"
|
||||
|
||||
#define min(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
@ -290,6 +291,11 @@ static void prefork_fork_master(
|
||||
|
||||
pid = getpid();
|
||||
setproctitle("task[%s] pre-fork master", service_name);
|
||||
/*
|
||||
* We must fit within 15 chars of text or we will truncate, so
|
||||
* we put the constant part last
|
||||
*/
|
||||
prctl_set_comment("%s[master]", service_name);
|
||||
|
||||
/*
|
||||
* this will free all the listening sockets and all state that
|
||||
@ -690,6 +696,13 @@ static void prefork_fork_worker(struct task_server *task,
|
||||
setproctitle("task[%s] pre-forked worker(%d)",
|
||||
service_name,
|
||||
pd->instances);
|
||||
/*
|
||||
* We must fit within 15 chars of text or we will truncate, so
|
||||
* we put child number last
|
||||
*/
|
||||
prctl_set_comment("%s(%d)",
|
||||
service_name,
|
||||
pd->instances);
|
||||
prefork_reload_after_fork();
|
||||
if (service_details->post_fork != NULL) {
|
||||
service_details->post_fork(task, pd);
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "lib/messaging/messaging.h"
|
||||
#include "lib/util/debug.h"
|
||||
#include "source3/lib/messages_dgm.h"
|
||||
#include "lib/util/util_process.h"
|
||||
|
||||
static unsigned connections_active = 0;
|
||||
static unsigned smbd_max_processes = 0;
|
||||
@ -342,6 +343,12 @@ static void standard_accept_connection(
|
||||
pid = getpid();
|
||||
setproctitle("task[%s] standard worker", proc_ctx->name);
|
||||
|
||||
/*
|
||||
* We must fit within 15 chars of text or we will truncate, so
|
||||
* we put the constant part last
|
||||
*/
|
||||
prctl_set_comment("%s[work]", proc_ctx->name);
|
||||
|
||||
/* This is now the child code. We need a completely new event_context to work with */
|
||||
|
||||
if (tevent_re_initialise(ev) != 0) {
|
||||
@ -501,6 +508,11 @@ static void standard_new_task(struct tevent_context *ev,
|
||||
}
|
||||
|
||||
setproctitle("task[%s]", service_name);
|
||||
/*
|
||||
* We must fit within 15 chars of text or we will truncate, so
|
||||
* we put the constant part last
|
||||
*/
|
||||
prctl_set_comment("%s[task]", service_name);
|
||||
|
||||
/*
|
||||
* Set up the process context to be passed through to the terminate
|
||||
|
Loading…
x
Reference in New Issue
Block a user