]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: also show job id in status output 34564/head
authorMike Yuan <me@yhndnzj.com>
Thu, 26 Sep 2024 15:36:24 +0000 (17:36 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 26 Sep 2024 15:59:00 +0000 (17:59 +0200)
Prompted by one ASG talk ;)

src/systemctl/systemctl-show.c

index 2f39bc2b12fefbd440b44f7d501402169763c719..60db148f4b5f9a6e2677568a42c78215a2f1529a 100644 (file)
@@ -196,6 +196,8 @@ typedef struct UnitStatusInfo {
 
         uint64_t runtime_max_sec;
 
+        uint32_t job_id;
+
         sd_id128_t invocation_id;
 
         bool need_daemon_reload;
@@ -472,6 +474,9 @@ static void print_status_info(
         } else
                 printf("\n");
 
+        if (i->job_id != 0)
+                printf("        Job: %" PRIu32 "\n", i->job_id);
+
         if (!sd_id128_is_null(i->invocation_id))
                 printf(" Invocation: " SD_ID128_FORMAT_STR "\n", SD_ID128_FORMAT_VAL(i->invocation_id));
 
@@ -2035,6 +2040,7 @@ static int show_one(
                 { "ActiveState",                    "s",               NULL,           offsetof(UnitStatusInfo, active_state)                      },
                 { "FreezerState",                   "s",               NULL,           offsetof(UnitStatusInfo, freezer_state)                     },
                 { "SubState",                       "s",               NULL,           offsetof(UnitStatusInfo, sub_state)                         },
+                { "Job",                            "(uo)",            bus_map_job_id, offsetof(UnitStatusInfo, job_id)                            },
                 { "UnitFileState",                  "s",               NULL,           offsetof(UnitStatusInfo, unit_file_state)                   },
                 { "UnitFilePreset",                 "s",               NULL,           offsetof(UnitStatusInfo, unit_file_preset)                  },
                 { "Description",                    "s",               NULL,           offsetof(UnitStatusInfo, description)                       },