systemctl: show tainted state

This commit is contained in:
Lennart Poettering 2022-03-30 16:11:28 +02:00 committed by Luca Boccassi
parent 40efaaed42
commit 45bff9b4e2
3 changed files with 23 additions and 8 deletions

View file

@ -15,11 +15,15 @@
#include "terminal-util.h"
const struct bus_properties_map machine_info_property_map[] = {
{ "SystemState", "s", NULL, offsetof(struct machine_info, state) },
{ "NJobs", "u", NULL, offsetof(struct machine_info, n_jobs) },
{ "NFailedUnits", "u", NULL, offsetof(struct machine_info, n_failed_units) },
{ "ControlGroup", "s", NULL, offsetof(struct machine_info, control_group) },
/* Might good to keep same order here as in bus_manager_vtable[], server side */
{ "Version", "s", NULL, offsetof(struct machine_info, version) },
{ "Tainted", "s", NULL, offsetof(struct machine_info, tainted) },
{ "UserspaceTimestamp", "t", NULL, offsetof(struct machine_info, timestamp) },
{ "NNames", "u", NULL, offsetof(struct machine_info, n_names) },
{ "NFailedUnits", "u", NULL, offsetof(struct machine_info, n_failed_units) },
{ "NJobs", "u", NULL, offsetof(struct machine_info, n_jobs) },
{ "ControlGroup", "s", NULL, offsetof(struct machine_info, control_group) },
{ "SystemState", "s", NULL, offsetof(struct machine_info, state) },
{}
};
@ -27,8 +31,10 @@ void machine_info_clear(struct machine_info *info) {
assert(info);
free(info->name);
free(info->state);
free(info->version);
free(info->tainted);
free(info->control_group);
free(info->state);
zero(*info);
}

View file

@ -12,11 +12,14 @@ int verb_list_machines(int argc, char *argv[], void *userdata);
struct machine_info {
bool is_host;
char *name;
char *state;
char *control_group;
char *version;
char *tainted;
uint64_t timestamp;
uint32_t n_names;
uint32_t n_failed_units;
uint32_t n_jobs;
usec_t timestamp;
char *control_group;
char *state;
};
void machine_info_clear(struct machine_info *info);

View file

@ -2129,6 +2129,7 @@ static int show_system_status(sd_bus *bus) {
printf(" State: %s%s%s\n",
on, strna(mi.state), off);
printf(" Units: %" PRIu32 " loaded (incl. loaded aliases)\n", mi.n_names);
printf(" Jobs: %" PRIu32 " queued\n", mi.n_jobs);
printf(" Failed: %" PRIu32 " units\n", mi.n_failed_units);
@ -2136,6 +2137,11 @@ static int show_system_status(sd_bus *bus) {
FORMAT_TIMESTAMP_STYLE(mi.timestamp, arg_timestamp_style),
FORMAT_TIMESTAMP_RELATIVE(mi.timestamp));
printf(" systemd: %s\n", mi.version);
if (!isempty(mi.tainted))
printf(" Tainted: %s%s%s\n", ansi_highlight_yellow(), mi.tainted, ansi_normal());
printf(" CGroup: %s\n", empty_to_root(mi.control_group));
c = LESS_BY(columns(), strlen(prefix));