From: Zbigniew Jędrzejewski-Szmek Date: Fri, 5 Jul 2019 11:34:54 +0000 (+0200) Subject: pid1: shorten dump output a bit by not repeating unit id twice X-Git-Tag: v243-rc1~142^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0121d1f28d0c8beb7c3145306189d5fcac1317cc;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/core/unit.c b/src/core/unit.c index d880e709ae0..a6a95f05204 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -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));