manager_flip_auto_status(u->manager, true);
unit_status_printf(u, ANSI_HIGHLIGHT_RED_ON "FAILED" ANSI_HIGHLIGHT_OFF, format);
- manager_status_printf(u->manager, false, NULL,
+ manager_status_printf(u->manager, STATUS_TYPE_NORMAL, NULL,
"See \"systemctl status %s%s%s\" for details.",
quotes ? "'" : "", u->id, quotes ? "'" : "");
break;
if (job_get_timeout(j, &x) > 0)
format_timespan(limit, sizeof(limit), x - j->begin_usec, 1*USEC_PER_SEC);
- manager_status_printf(m, true, cylon,
+ manager_status_printf(m, STATUS_TYPE_EPHEMERAL, cylon,
"%sA %s job is running for %s (%s / %s)",
strempty(job_of_n),
job_type_to_string(j->type),
unlink("/run/systemd/show-status");
}
-static bool manager_get_show_status(Manager *m) {
+static bool manager_get_show_status(Manager *m, StatusType type) {
assert(m);
if (m->running_as != SYSTEMD_SYSTEM)
unlink("/run/systemd/first-boot");
}
-void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) {
+void manager_status_printf(Manager *m, StatusType type, const char *status, const char *format, ...) {
va_list ap;
- if (!manager_get_show_status(m))
+ if (!manager_get_show_status(m, type))
return;
/* XXX We should totally drop the check for ephemeral here
* and thus effectively make 'Type=idle' pointless. */
- if (ephemeral && m->n_on_console > 0)
+ if (type == STATUS_TYPE_EPHEMERAL && m->n_on_console > 0)
return;
va_start(ap, format);
- status_vprintf(status, true, ephemeral, format, ap);
+ status_vprintf(status, true, type == STATUS_TYPE_EPHEMERAL, format, ap);
va_end(ap);
}
_MANAGER_EXIT_CODE_INVALID = -1
} ManagerExitCode;
+typedef enum StatusType {
+ STATUS_TYPE_EPHEMERAL,
+ STATUS_TYPE_NORMAL,
+} StatusType;
+
#include "unit.h"
#include "job.h"
#include "hashmap.h"
void manager_set_show_status(Manager *m, ShowStatus mode);
void manager_set_first_boot(Manager *m, bool b);
-void manager_status_printf(Manager *m, bool ephemeral, const char *status, const char *format, ...) _printf_(4,5);
+void manager_status_printf(Manager *m, StatusType type, const char *status, const char *format, ...) _printf_(4,5);
void manager_flip_auto_status(Manager *m, bool enable);
Set *manager_get_units_requiring_mounts_for(Manager *m, const char *path);
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) {
DISABLE_WARNING_FORMAT_NONLITERAL;
- manager_status_printf(u->manager, false, status, unit_status_msg_format, unit_description(u));
+ manager_status_printf(u->manager, STATUS_TYPE_NORMAL,
+ status, unit_status_msg_format, unit_description(u));
REENABLE_WARNING;
}