process-util: add pidref_get_comm() and rename get_process_comm() to pid_get_comm()

This commit is contained in:
Lennart Poettering
2023-10-18 14:39:33 +02:00
parent d57d521cae
commit d7d748548b
28 changed files with 80 additions and 59 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ int sigrtmin18_handler(sd_event_source *s, const struct signalfd_siginfo *si, vo
assert(s);
assert(si);
(void) get_process_comm(si->ssi_pid, &comm);
(void) pid_get_comm(si->ssi_pid, &comm);
if (si->ssi_code != SI_QUEUE) {
log_notice("Received control signal %s from process " PID_FMT " (%s) without command value, ignoring.",
+3 -3
View File
@@ -101,7 +101,7 @@ static bool ignore_proc(pid_t pid, bool warn_rootfs) {
_cleanup_free_ char *comm = NULL;
(void) get_process_comm(pid, &comm);
(void) pid_get_comm(pid, &comm);
log_notice("Process " PID_FMT " (%s) has been marked to be excluded from killing. It is "
"running from the root file system, and thus likely to block re-mounting of the "
@@ -120,7 +120,7 @@ static void log_children_no_yet_killed(Set *pids) {
SET_FOREACH(p, pids) {
_cleanup_free_ char *s = NULL;
if (get_process_comm(PTR_TO_PID(p), &s) >= 0)
if (pid_get_comm(PTR_TO_PID(p), &s) >= 0)
r = strextendf(&lst_child, ", " PID_FMT " (%s)", PTR_TO_PID(p), s);
else
r = strextendf(&lst_child, ", " PID_FMT, PTR_TO_PID(p));
@@ -248,7 +248,7 @@ static int killall(int sig, Set *pids, bool send_sighup) {
if (sig == SIGKILL) {
_cleanup_free_ char *s = NULL;
(void) get_process_comm(pid, &s);
(void) pid_get_comm(pid, &s);
log_notice("Sending SIGKILL to PID "PID_FMT" (%s).", pid, strna(s));
}