ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Arseny Maslennikov <arseny@altlinux.org>
To: devel@lists.altlinux.org, ldv@altlinux.org
Cc: Arseny Maslennikov <arseny@altlinux.org>
Subject: [devel] [PATCH v2 3/6] daemon: set titles for subprocesses
Date: Thu, 22 Oct 2020 14:43:40 +0300
Message-ID: <20201022114343.1810141-4-arseny@altlinux.org> (raw)
In-Reply-To: <20201022114343.1810141-1-arseny@altlinux.org>

Signed-off-by: Arseny Maslennikov <arseny@altlinux.org>
---
 hasher-priv/caller_server.c | 3 +++
 hasher-priv/caller_task.c   | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/hasher-priv/caller_server.c b/hasher-priv/caller_server.c
index abc2746..d472d9a 100644
--- a/hasher-priv/caller_server.c
+++ b/hasher-priv/caller_server.c
@@ -19,6 +19,8 @@
 #include <unistd.h>
 #include <grp.h>
 
+#include <setproctitle.h>
+
 #include "priv.h"
 #include "xmalloc.h"
 #include "sockets.h"
@@ -364,6 +366,7 @@ fork_server(int cl_conn, uid_t uid, gid_t gid, unsigned num)
 
 	if (ret >= 0) {
 		info("%s(%d) num=%u: start session server", caller_user, caller_uid, caller_num);
+		setproctitle("%s %s/%u:%u", "privileged helper for", caller_user, caller_uid, caller_num);
 		ret = caller_server(cl_conn);
 		info("%s(%d): finish session server", caller_user, caller_uid);
 	}
diff --git a/hasher-priv/caller_task.c b/hasher-priv/caller_task.c
index 8965196..46745a2 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"
@@ -96,6 +98,8 @@ 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);
 
@@ -175,6 +179,8 @@ process_caller_task(int conn, struct task *task)
 		return pid;
 	}
 
+	setproctitle("%s", __func__);
+
 	if ((cpid = caller_task(task)) > 0) {
 		while (1) {
 			pid_t w;
-- 
2.25.4



  parent reply	other threads:[~2020-10-22 11:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-22 11:43 [devel] [PATCH hasher-priv v2 0/6] hasher-privd Arseny Maslennikov
2020-10-22 11:43 ` [devel] [PATCH v2 1/6] Turn hasher-priv into a daemon Arseny Maslennikov
2020-10-22 11:43 ` [devel] [PATCH v2 2/6] Link with libsetproctitle by Dmitry V. Levin Arseny Maslennikov
2020-10-22 11:43 ` Arseny Maslennikov [this message]
2020-10-22 11:43 ` [devel] [PATCH v2 4/6] Add systemd and sysvinit service files Arseny Maslennikov
2020-10-22 11:49   ` [devel] [PATCH v2 4/6] Add systemd and sysvinit service files: missing signoff Arseny Maslennikov
2020-10-22 11:43 ` [devel] [PATCH v2 5/6] Install hasher-priv without set ugids Arseny Maslennikov
2020-10-22 11:43 ` [devel] [PATCH v2 6/6] Add preliminary cgroup support 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=20201022114343.1810141-4-arseny@altlinux.org \
    --to=arseny@altlinux.org \
    --cc=devel@lists.altlinux.org \
    --cc=ldv@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