[devel] [PATCH hasher-priv v3 5/7] daemon: set titles for subprocesses
Arseny Maslennikov
arseny на altlinux.org
Вт Авг 24 11:24:34 MSK 2021
Signed-off-by: Arseny Maslennikov <arseny на altlinux.org>
---
hasher-priv/caller_task.c | 6 ++++++
hasher-priv/hasher-privd.c | 2 ++
2 files changed, 8 insertions(+)
diff --git a/hasher-priv/caller_task.c b/hasher-priv/caller_task.c
index 7a9fc98..0a37977 100644
--- a/hasher-priv/caller_task.c
+++ b/hasher-priv/caller_task.c
@@ -16,6 +16,8 @@
#include <stdio.h>
#include <stdint.h>
+#include <setproctitle.h>
+
#include "communication.h"
#include "xmalloc.h"
#include "logging.h"
@@ -100,6 +102,8 @@ spawn_caller_task(struct task *task)
return pid;
}
+ setproctitle("%s for [%u:%u]: %s", "task handler", caller_uid, caller_num, task2str(task->type));
+
if ((rc = reopen_iostreams(task->stdin, task->stdout, task->stderr)) < 0)
exit(rc);
@@ -187,6 +191,8 @@ process_cmd_task_run(struct hadaemon* d, int conn, struct task *task)
if (d->fd_conn >= 0)
close(d->fd_conn);
+ setproctitle("%s", __func__);
+
if ((cpid = spawn_caller_task(task)) > 0) {
while (1) {
pid_t w;
diff --git a/hasher-priv/hasher-privd.c b/hasher-priv/hasher-privd.c
index 06f2811..2cc7588 100644
--- a/hasher-priv/hasher-privd.c
+++ b/hasher-priv/hasher-privd.c
@@ -71,6 +71,8 @@ spawn_caller_server(struct hadaemon* d, int cl_conn, struct session *a)
goto out_send_failure;
}
+ setproctitle("%s %s/%u:%u", "privileged helper for", caller_user, caller_uid, caller_num);
+
info("%s(%d) num=%u: starting session server", caller_user, caller_uid, caller_num);
struct hadaemon sh = {};
--
2.32.0
Подробная информация о списке рассылки Devel