Skip to content

Commit 45bff9b

Browse files
poetteringbluca
authored andcommitted
systemctl: show tainted state
1 parent 40efaae commit 45bff9b

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

src/systemctl/systemctl-list-machines.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,26 @@
1515
#include "terminal-util.h"
1616

1717
const struct bus_properties_map machine_info_property_map[] = {
18-
{ "SystemState", "s", NULL, offsetof(struct machine_info, state) },
19-
{ "NJobs", "u", NULL, offsetof(struct machine_info, n_jobs) },
18+
/* Might good to keep same order here as in bus_manager_vtable[], server side */
19+
{ "Version", "s", NULL, offsetof(struct machine_info, version) },
20+
{ "Tainted", "s", NULL, offsetof(struct machine_info, tainted) },
21+
{ "UserspaceTimestamp", "t", NULL, offsetof(struct machine_info, timestamp) },
22+
{ "NNames", "u", NULL, offsetof(struct machine_info, n_names) },
2023
{ "NFailedUnits", "u", NULL, offsetof(struct machine_info, n_failed_units) },
24+
{ "NJobs", "u", NULL, offsetof(struct machine_info, n_jobs) },
2125
{ "ControlGroup", "s", NULL, offsetof(struct machine_info, control_group) },
22-
{ "UserspaceTimestamp", "t", NULL, offsetof(struct machine_info, timestamp) },
26+
{ "SystemState", "s", NULL, offsetof(struct machine_info, state) },
2327
{}
2428
};
2529

2630
void machine_info_clear(struct machine_info *info) {
2731
assert(info);
2832

2933
free(info->name);
30-
free(info->state);
34+
free(info->version);
35+
free(info->tainted);
3136
free(info->control_group);
37+
free(info->state);
3238
zero(*info);
3339
}
3440

src/systemctl/systemctl-list-machines.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ int verb_list_machines(int argc, char *argv[], void *userdata);
1212
struct machine_info {
1313
bool is_host;
1414
char *name;
15-
char *state;
16-
char *control_group;
15+
char *version;
16+
char *tainted;
17+
uint64_t timestamp;
18+
uint32_t n_names;
1719
uint32_t n_failed_units;
1820
uint32_t n_jobs;
19-
usec_t timestamp;
21+
char *control_group;
22+
char *state;
2023
};
2124

2225
void machine_info_clear(struct machine_info *info);

src/systemctl/systemctl-show.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,13 +2129,19 @@ static int show_system_status(sd_bus *bus) {
21292129
printf(" State: %s%s%s\n",
21302130
on, strna(mi.state), off);
21312131

2132+
printf(" Units: %" PRIu32 " loaded (incl. loaded aliases)\n", mi.n_names);
21322133
printf(" Jobs: %" PRIu32 " queued\n", mi.n_jobs);
21332134
printf(" Failed: %" PRIu32 " units\n", mi.n_failed_units);
21342135

21352136
printf(" Since: %s; %s\n",
21362137
FORMAT_TIMESTAMP_STYLE(mi.timestamp, arg_timestamp_style),
21372138
FORMAT_TIMESTAMP_RELATIVE(mi.timestamp));
21382139

2140+
printf(" systemd: %s\n", mi.version);
2141+
2142+
if (!isempty(mi.tainted))
2143+
printf(" Tainted: %s%s%s\n", ansi_highlight_yellow(), mi.tainted, ansi_normal());
2144+
21392145
printf(" CGroup: %s\n", empty_to_root(mi.control_group));
21402146

21412147
c = LESS_BY(columns(), strlen(prefix));

0 commit comments

Comments
 (0)