/* SPDX-License-Identifier: LGPL-2.1+ */
/***
- This file is part of systemd.
-
- Copyright 2010 Lennart Poettering
- Copyright 2013 Marc-Antoine Perennou
+ Copyright © 2013 Marc-Antoine Perennou
***/
#include <errno.h>
if (!arg_no_legend &&
(streq(u->active_state, "failed") ||
- STR_IN_SET(u->load_state, "error", "not-found", "masked")))
+ STR_IN_SET(u->load_state, "error", "not-found", "bad-setting", "masked")))
circle_len = 2;
}
underline = true;
}
- if (STR_IN_SET(u->load_state, "error", "not-found", "masked") && !arg_plain) {
+ if (STR_IN_SET(u->load_state, "error", "not-found", "bad-setting", "masked") && !arg_plain) {
on_circle = ansi_highlight_yellow();
off_circle = ansi_normal();
circle = true;
/* Socket */
unsigned n_accepted;
unsigned n_connections;
+ unsigned n_refused;
bool accept;
/* Pairs of type, path */
UnitStatusInfo *i,
bool *ellipsized) {
- char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], *s1, since2[FORMAT_TIMESTAMP_MAX], *s2;
- const char *active_on, *active_off, *on, *off, *ss;
+ char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], since2[FORMAT_TIMESTAMP_MAX];
+ const char *s1, *s2, *active_on, *active_off, *on, *off, *ss;
_cleanup_free_ char *formatted_path = NULL;
ExecStatusInfo *p;
usec_t timestamp;
if (i->following)
printf(" Follow: unit currently follows state of %s\n", i->following);
- if (streq_ptr(i->load_state, "error")) {
+ if (STRPTR_IN_SET(i->load_state, "error", "not-found", "bad-setting")) {
on = ansi_highlight_red();
off = ansi_normal();
} else
if (path && terminal_urlify_path(path, NULL, &formatted_path) >= 0)
path = formatted_path;
- if (i->load_error != 0)
+ if (!isempty(i->load_error))
printf(" Loaded: %s%s%s (Reason: %s)\n",
on, strna(i->load_state), off, i->load_error);
else if (path && !isempty(i->unit_file_state) && !isempty(i->unit_file_preset) &&
if (endswith(i->id, ".timer")) {
char tstamp1[FORMAT_TIMESTAMP_RELATIVE_MAX],
tstamp2[FORMAT_TIMESTAMP_MAX];
- char *next_rel_time, *next_time;
+ const char *next_rel_time, *next_time;
dual_timestamp nw, next = {i->next_elapse_real,
i->next_elapse_monotonic};
usec_t next_elapse;
dual_timestamp_get(&nw);
next_elapse = calc_next_elapse(&nw, &next);
- next_rel_time = format_timestamp_relative(tstamp1,
- sizeof(tstamp1),
- next_elapse);
- next_time = format_timestamp(tstamp2,
- sizeof(tstamp2),
- next_elapse);
+ next_rel_time = format_timestamp_relative(tstamp1, sizeof tstamp1, next_elapse);
+ next_time = format_timestamp(tstamp2, sizeof tstamp2, next_elapse);
if (next_time && next_rel_time)
printf("%s; %s\n", next_time, next_rel_time);
STRV_FOREACH_PAIR(t, t2, i->listen)
printf(" %*s %s (%s)\n", 9, t == i->listen ? "Listen:" : "", *t2, *t);
- if (i->accept)
- printf(" Accepted: %u; Connected: %u\n", i->n_accepted, i->n_connections);
+ if (i->accept) {
+ printf(" Accepted: %u; Connected: %u;", i->n_accepted, i->n_connections);
+ if (i->n_refused)
+ printf(" Refused: %u", i->n_refused);
+ printf("\n");
+ }
LIST_FOREACH(exec, p, i->exec) {
_cleanup_free_ char *argv = NULL;
show_cgroup_and_extra(SYSTEMD_CGROUP_CONTROLLER, i->control_group, prefix, c, extra, k, get_output_flags());
} else if (r < 0)
- log_warning_errno(r, "Failed to dump process list, ignoring: %s", bus_error_message(&error, r));
+ log_warning_errno(r, "Failed to dump process list for '%s', ignoring: %s", i->id, bus_error_message(&error, r));
}
if (i->id && arg_transport == BUS_TRANSPORT_LOCAL)
{ "NextElapseUSecMonotonic", "t", NULL, offsetof(UnitStatusInfo, next_elapse_monotonic) },
{ "NAccepted", "u", NULL, offsetof(UnitStatusInfo, n_accepted) },
{ "NConnections", "u", NULL, offsetof(UnitStatusInfo, n_connections) },
+ { "NRefused", "u", NULL, offsetof(UnitStatusInfo, n_refused) },
{ "Accept", "b", NULL, offsetof(UnitStatusInfo, accept) },
{ "Listen", "a(ss)", map_listen, offsetof(UnitStatusInfo, listen) },
{ "SysFSPath", "s", NULL, offsetof(UnitStatusInfo, sysfs_path) },
return -EINVAL;
}
+ if (arg_runtime && STRPTR_IN_SET(argv[optind], "disable", "unmask", "preset", "preset-all")) {
+ log_error("--runtime cannot be used with %s", argv[optind]);
+ return -EINVAL;
+ }
+
return 1;
}