killall: show PID of processes killed in final killing spree

Let's show the PID of killed processes in all cases, to make debugging
easier.

See: https://lists.freedesktop.org/archives/systemd-devel/2022-March/047504.html
This commit is contained in:
Lennart Poettering
2022-03-03 22:45:47 +01:00
parent 3a0692e3a8
commit 94ce42bcb6
+6 -5
View File
@@ -81,15 +81,16 @@ static bool ignore_proc(pid_t pid, bool warn_rootfs) {
static void log_children_no_yet_killed(Set *pids) {
_cleanup_free_ char *lst_child = NULL;
void *p;
int r;
SET_FOREACH(p, pids) {
_cleanup_free_ char *s = NULL;
char fallback[DECIMAL_STR_MAX(pid_t)];
if (get_process_comm(PTR_TO_PID(p), &s) < 0)
xsprintf(fallback, PID_FMT, PTR_TO_PID(p));
if (!strextend(&lst_child, ", ", s ?: fallback))
if (get_process_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));
if (r < 0)
return (void) log_oom();
}