From f1d345ed76f5d4f46b67b7a2d3df2db1a9f51840 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 18 Apr 2024 11:18:35 +0200 Subject: [PATCH] systemctl: show invocation ID in unit status output I think we should put more emphasis on the invocation ID as a handle for a specific runtime cycle of a unit. Let's start with actually showing it to users. See: #16035 --- src/systemctl/systemctl-show.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c index 7926bfbecaf..aee839de4ca 100644 --- a/src/systemctl/systemctl-show.c +++ b/src/systemctl/systemctl-show.c @@ -196,6 +196,8 @@ typedef struct UnitStatusInfo { uint64_t runtime_max_sec; + sd_id128_t invocation_id; + bool need_daemon_reload; bool transient; @@ -468,6 +470,9 @@ static void print_status_info( } else printf("\n"); + if (!sd_id128_is_null(i->invocation_id)) + printf(" Invocation: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(i->invocation_id)); + STRV_FOREACH(t, i->triggered_by) { UnitActiveState state = _UNIT_ACTIVE_STATE_INVALID; @@ -2031,8 +2036,9 @@ static int show_one( { "InactiveExitTimestampMonotonic", "t", NULL, offsetof(UnitStatusInfo, inactive_exit_timestamp_monotonic) }, { "ActiveEnterTimestamp", "t", NULL, offsetof(UnitStatusInfo, active_enter_timestamp) }, { "ActiveExitTimestamp", "t", NULL, offsetof(UnitStatusInfo, active_exit_timestamp) }, - { "RuntimeMaxUSec", "t", NULL, offsetof(UnitStatusInfo, runtime_max_sec) }, { "InactiveEnterTimestamp", "t", NULL, offsetof(UnitStatusInfo, inactive_enter_timestamp) }, + { "RuntimeMaxUSec", "t", NULL, offsetof(UnitStatusInfo, runtime_max_sec) }, + { "InvocationID", "s", bus_map_id128, offsetof(UnitStatusInfo, invocation_id) }, { "NeedDaemonReload", "b", NULL, offsetof(UnitStatusInfo, need_daemon_reload) }, { "Transient", "b", NULL, offsetof(UnitStatusInfo, transient) }, { "ExecMainPID", "u", NULL, offsetof(UnitStatusInfo, main_pid) }, -- 2.47.3