1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 02:21:44 +03:00

systemctl: fix output alignment in "systemctl status"

If we show both a control and a main PID for a service fix this line in the
output of "systemctl status":

 Main PID: 19670 (sleep);         : 19671 (sleep)

to become this:

 Main PID: 19670 (sleep); Control PID: 19671 (sleep)
This commit is contained in:
Lennart Poettering 2016-07-21 18:05:58 +02:00
parent 691675ba9f
commit 1089dcd469

View File

@ -3761,7 +3761,7 @@ static void print_status_info(
if (i->running) {
_cleanup_free_ char *comm = NULL;
get_process_comm(i->main_pid, &comm);
(void) get_process_comm(i->main_pid, &comm);
if (comm)
printf(" (%s)", comm);
} else if (i->exit_code > 0) {
@ -3780,17 +3780,19 @@ static void print_status_info(
printf("signal=%s", signal_to_string(i->exit_status));
printf(")");
}
if (i->control_pid > 0)
printf(";");
}
if (i->control_pid > 0) {
_cleanup_free_ char *c = NULL;
printf(" %8s: "PID_FMT, i->main_pid ? "" : " Control", i->control_pid);
if (i->main_pid > 0)
fputs("; Control PID: ", stdout);
else
fputs("Cntrl PID: ", stdout); /* if first in column, abbreviated so it fits alignment */
get_process_comm(i->control_pid, &c);
printf(PID_FMT, i->control_pid);
(void) get_process_comm(i->control_pid, &c);
if (c)
printf(" (%s)", c);
}