ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Arseny Maslennikov <arseny@altlinux.org>
To: devel@lists.altlinux.org
Cc: Arseny Maslennikov <arseny@altlinux.org>
Subject: [devel] [PATCH hasher-priv v3 5/7] daemon: set titles for subprocesses
Date: Tue, 24 Aug 2021 11:24:34 +0300
Message-ID: <20210824082436.1555890-6-arseny@altlinux.org> (raw)
In-Reply-To: <20210824082436.1555890-1-arseny@altlinux.org>

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



  parent reply	other threads:[~2021-08-24  8:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  8:24 [devel] [PATCH hasher-priv v3 0/7] hasher-privd Arseny Maslennikov
2021-08-24  8:24 ` [devel] [PATCH hasher-priv v3 1/7] Turn hasher-priv into a daemon Arseny Maslennikov
2021-08-24  8:24 ` [devel] [PATCH hasher-priv v3 2/7] sockets: xsendmsg: get rid of SIGPIPE on socket writes Arseny Maslennikov
2021-08-24  8:24 ` [devel] [PATCH hasher-priv v3 3/7] chrootuid: explicitly reset signal mask before forking off payload Arseny Maslennikov
2021-12-01 19:23   ` Dmitry V. Levin
2021-12-03 15:03     ` Arseny Maslennikov
2021-12-03 16:06       ` Dmitry V. Levin
2021-08-24  8:24 ` [devel] [PATCH hasher-priv v3 4/7] Link with libsetproctitle by Dmitry V. Levin Arseny Maslennikov
2021-08-24  8:24 ` Arseny Maslennikov [this message]
2021-08-24  8:24 ` [devel] [PATCH hasher-priv v3 6/7] Add systemd and sysvinit service files Arseny Maslennikov
2021-08-24  8:24 ` [devel] [PATCH hasher-priv v3 7/7] Install hasher-priv without set ugids Arseny Maslennikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210824082436.1555890-6-arseny@altlinux.org \
    --to=arseny@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git