1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

pid1: shorten dump output a bit by not repeating unit id twice

Most units have just one name, but we'd print it twice:
-> Unit systemd-sysctl.service:
        ...
	Name: systemd-sysctl.service

Let's only print the "main" name once, and call the other names Aliases.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-07-05 13:34:54 +02:00
parent 8e27167cc9
commit 0121d1f28d

View File

@ -1143,7 +1143,14 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
prefix2 = strjoina(prefix, "\t");
fprintf(f,
"%s-> Unit %s:\n"
"%s-> Unit %s:\n",
prefix, u->id);
SET_FOREACH(t, u->names, i)
if (!streq(t, u->id))
fprintf(f, "%s\tAlias: %s\n", prefix, t);
fprintf(f,
"%s\tDescription: %s\n"
"%s\tInstance: %s\n"
"%s\tUnit Load State: %s\n"
@ -1161,7 +1168,6 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
"%s\tSlice: %s\n"
"%s\tCGroup: %s\n"
"%s\tCGroup realized: %s\n",
prefix, u->id,
prefix, unit_description(u),
prefix, strna(u->instance),
prefix, unit_load_state_to_string(u->load_state),
@ -1213,9 +1219,6 @@ void unit_dump(Unit *u, FILE *f, const char *prefix) {
fprintf(f, "%s\tCGroup delegate mask: %s\n", prefix, strnull(s));
}
SET_FOREACH(t, u->names, i)
fprintf(f, "%s\tName: %s\n", prefix, t);
if (!sd_id128_is_null(u->invocation_id))
fprintf(f, "%s\tInvocation ID: " SD_ID128_FORMAT_STR "\n",
prefix, SD_ID128_FORMAT_VAL(u->invocation_id));