* maybe add support for specifier expansion in user.conf, specifically DefaultEnvironment=
-* consider showing the unit names during boot up in the status output, not just the unit descriptions
-
* maybe allow timer units with an empty Units= setting, so that they
can be used for resuming the system but nothing else.
format = job_get_begin_status_message_format(u, t);
DISABLE_WARNING_FORMAT_NONLITERAL;
- (void) snprintf(buf, sizeof buf, format, unit_description(u));
+ (void) snprintf(buf, sizeof buf, format, unit_status_string(u));
REENABLE_WARNING;
mid = t == JOB_START ? "MESSAGE_ID=" SD_MESSAGE_UNIT_STARTING_STR :
/* Show condition check message if the job did not actually do anything due to failed condition. */
if (t == JOB_START && result == JOB_DONE && !u->condition_result) {
log_struct(LOG_INFO,
- "MESSAGE=Condition check resulted in %s being skipped.", unit_description(u),
+ "MESSAGE=Condition check resulted in %s being skipped.", unit_status_string(u),
"JOB_ID=%" PRIu32, job_id,
"JOB_TYPE=%s", job_type_to_string(t),
"JOB_RESULT=%s", job_result_to_string(result),
* xsprintf() on purpose here: we are fine with truncation and don't
* consider that an error. */
DISABLE_WARNING_FORMAT_NONLITERAL;
- (void) snprintf(buf, sizeof(buf), format, unit_description(u));
+ (void) snprintf(buf, sizeof(buf), format, unit_status_string(u));
REENABLE_WARNING;
switch (t) {
"%sA %s job is running for %s (%s / %s)",
strempty(job_of_n),
job_type_to_string(j->type),
- unit_description(j->unit),
+ unit_status_string(j->unit),
time, limit);
}
return strna(u->id);
}
+const char *unit_status_string(Unit *u) {
+ assert(u);
+
+ if (u->manager->status_unit_format == STATUS_UNIT_FORMAT_NAME && u->id)
+ return u->id;
+
+ return unit_description(u);
+}
+
static void print_unit_dependency_mask(FILE *f, const char *kind, UnitDependencyMask mask, bool *space) {
const struct {
UnitDependencyMask mask;
void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) {
const char *d;
- d = unit_description(u);
+ d = unit_status_string(u);
if (log_get_show_color())
d = strjoina(ANSI_HIGHLIGHT, d, ANSI_NORMAL);