static int arg_signal = SIGTERM;
static char *arg_root = NULL;
static usec_t arg_when = 0;
+static const char *arg_reboot_argument = NULL;
static enum action {
ACTION_SYSTEMCTL,
ACTION_HALT,
}
static int compare_unit_info(const UnitInfo *a, const UnitInfo *b) {
- const char *d1, *d2;
int r;
/* First, order by machine */
- if (!a->machine && b->machine)
- return -1;
- if (a->machine && !b->machine)
- return 1;
- if (a->machine && b->machine) {
- r = strcasecmp(a->machine, b->machine);
- if (r != 0)
- return r;
- }
+ r = strcasecmp_ptr(a->machine, b->machine);
+ if (r != 0)
+ return r;
/* Second, order by unit type */
- d1 = strrchr(a->id, '.');
- d2 = strrchr(b->id, '.');
- if (d1 && d2) {
- r = strcasecmp(d1, d2);
- if (r != 0)
- return r;
- }
+ r = strcasecmp_ptr(strrchr(a->id, '.'), strrchr(b->id, '.'));
+ if (r != 0)
+ return r;
/* Third, order by name */
return strcasecmp(a->id, b->id);
return true;
}
+static int output_table(Table *table) {
+ int r;
+
+ assert(table);
+
+ if (OUTPUT_MODE_IS_JSON(arg_output))
+ r = table_print_json(table, NULL, output_mode_to_json_format_flags(arg_output) | JSON_FORMAT_COLOR_AUTO);
+ else
+ r = table_print(table, NULL);
+ if (r < 0)
+ return log_error_errno(r, "Failed to show table: %m");
+
+ return 0;
+}
+
static int output_units_list(const UnitInfo *unit_infos, unsigned c) {
_cleanup_(table_unrefp) Table *table = NULL;
- const UnitInfo *u;
- int job_count = 0;
int r;
table = table_new("", "unit", "load", "active", "sub", "job", "description");
return log_oom();
table_set_header(table, !arg_no_legend);
- if (arg_no_legend) {
- /* Hide the 'glyph' column when --no-legend is requested */
+ if (arg_plain) {
+ /* Hide the 'glyph' column when --plain is requested */
r = table_hide_column_from_display(table, 0);
if (r < 0)
return log_error_errno(r, "Failed to hide column: %m");
if (arg_full)
table_set_width(table, 0);
- for (u = unit_infos; u < unit_infos + c; u++) {
+ (void) table_set_empty_string(table, "-");
+
+ int job_count = 0;
+ for (const UnitInfo *u = unit_infos; unit_infos && u < unit_infos + c; u++) {
_cleanup_free_ char *j = NULL;
const char *on_underline = "", *on_loaded = "", *on_active = "";
const char *on_circle = "", *id;
}
if (STR_IN_SET(u->load_state, "error", "not-found", "bad-setting", "masked") && !arg_plain) {
- on_circle = ansi_highlight_yellow();
+ on_circle = underline ? ansi_highlight_yellow_underline() : ansi_highlight_yellow();
circle = true;
on_loaded = underline ? ansi_highlight_red_underline() : ansi_highlight_red();
} else if (streq(u->active_state, "failed") && !arg_plain) {
- on_circle = ansi_highlight_red();
+ on_circle = underline ? ansi_highlight_red_underline() : ansi_highlight_red();
circle = true;
on_active = underline ? ansi_highlight_red_underline() : ansi_highlight_red();
} else {
+ on_circle = on_underline;
on_active = on_underline;
on_loaded = on_underline;
}
r = table_add_many(table,
TABLE_STRING, circle ? special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE) : " ",
- TABLE_SET_COLOR, on_circle,
+ TABLE_SET_BOTH_COLORS, on_circle,
TABLE_STRING, id,
- TABLE_SET_COLOR, on_active,
+ TABLE_SET_BOTH_COLORS, on_active,
TABLE_STRING, u->load_state,
- TABLE_SET_COLOR, on_loaded,
+ TABLE_SET_BOTH_COLORS, on_loaded,
TABLE_STRING, u->active_state,
- TABLE_SET_COLOR, on_active,
+ TABLE_SET_BOTH_COLORS, on_active,
TABLE_STRING, u->sub_state,
- TABLE_SET_COLOR, on_active,
+ TABLE_SET_BOTH_COLORS, on_active,
TABLE_STRING, u->job_id ? u->job_type: "",
- TABLE_SET_COLOR, u->job_id ? on_underline : "",
+ TABLE_SET_BOTH_COLORS, u->job_id ? on_underline : "",
TABLE_STRING, u->description,
- TABLE_SET_COLOR, on_underline);
+ TABLE_SET_BOTH_COLORS, on_underline);
if (r < 0)
return table_log_add_error(r);
return log_error_errno(r, "Failed to hide column: %m");
}
- r = table_print(table, NULL);
+ r = output_table(table);
if (r < 0)
- return log_error_errno(r, "Failed to print the table: %m");
+ return r;
if (!arg_no_legend) {
const char *on, *off;
assert(unit_infos);
assert(_reply);
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ListUnitsByPatterns");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "ListUnitsByPatterns");
if (r < 0)
return bus_log_create_error(r);
m = sd_bus_message_unref(m);
sd_bus_error_free(&error);
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ListUnitsFiltered");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "ListUnitsFiltered");
if (r < 0)
return bus_log_create_error(r);
assert(a);
assert(b);
- if (!a->machine && b->machine)
- return -1;
- if (a->machine && !b->machine)
- return 1;
- if (a->machine && b->machine) {
- r = strcasecmp(a->machine, b->machine);
- if (r != 0)
- return r;
- }
+ r = strcasecmp_ptr(a->machine, b->machine);
+ if (r != 0)
+ return r;
r = strcmp(a->path, b->path);
- if (r == 0)
- r = strcmp(a->type, b->type);
+ if (r != 0)
+ return r;
- return r;
+ return strcmp(a->type, b->type);
}
static int output_sockets_list(struct socket_info *socket_infos, unsigned cs) {
const char *on, *off;
int r;
- table = table_new("listen", "type", "units", "activates");
+ table = table_new("listen", "type", "unit", "activates");
if (!table)
return log_oom();
if (arg_full)
table_set_width(table, 0);
+ (void) table_set_empty_string(table, "-");
+
if (cs) {
for (s = socket_infos; s < socket_infos + cs; s++) {
- _cleanup_free_ char *j = NULL, *activates = NULL;
+ _cleanup_free_ char *j = NULL;
const char *path;
if (s->machine) {
} else
path = s->path;
- activates = strv_join(s->triggered, ", ");
- if (!activates)
- return log_oom();
-
r = table_add_many(table,
TABLE_STRING, path,
TABLE_STRING, s->type,
- TABLE_STRING, s->id,
- TABLE_STRING, activates);
+ TABLE_STRING, s->id);
if (r < 0)
return table_log_add_error(r);
+
+ if (strv_isempty(s->triggered))
+ r = table_add_cell(table, NULL, TABLE_EMPTY, NULL);
+ else if (strv_length(s->triggered) == 1)
+ r = table_add_cell(table, NULL, TABLE_STRING, s->triggered[0]);
+ else
+ /* This should never happen, currently our socket units can only trigger a
+ * single unit. But let's handle this anyway, who knows what the future
+ * brings? */
+ r = table_add_cell(table, NULL, TABLE_STRV, s->triggered);
+ if (r < 0)
+ return table_log_add_error(r);
+
}
on = ansi_highlight();
off = ansi_normal();
}
- r = table_print(table, NULL);
+ r = output_table(table);
if (r < 0)
- return log_error_errno(r, "Failed to print the table: %m");
+ return r;
if (!arg_no_legend) {
printf("\n%s%u sockets listed.%s\n", on, cs, off);
assert(a);
assert(b);
- if (!a->machine && b->machine)
- return -1;
- if (a->machine && !b->machine)
- return 1;
- if (a->machine && b->machine) {
- r = strcasecmp(a->machine, b->machine);
- if (r != 0)
- return r;
- }
+ r = strcasecmp_ptr(a->machine, b->machine);
+ if (r != 0)
+ return r;
r = CMP(a->next_elapse, b->next_elapse);
if (r != 0)
if (arg_full)
table_set_width(table, 0);
+ (void) table_set_empty_string(table, "-");
+
if (n > 0) {
for (t = timer_infos; t < timer_infos + n; t++) {
_cleanup_free_ char *j = NULL, *activates = NULL;
off = ansi_normal();
}
- r = table_print(table, NULL);
+ r = output_table(table);
if (r < 0)
- return log_error_errno(r, "Failed to print the table: %m");
+ return r;
if (!arg_no_legend) {
printf("\n%s%u timers listed.%s\n", on, n, off);
return true;
}
+static bool show_preset_for_state(UnitFileState state) {
+ /* Don't show preset state in those unit file states, it'll only confuse users. */
+ return !IN_SET(state,
+ UNIT_FILE_ALIAS,
+ UNIT_FILE_STATIC,
+ UNIT_FILE_GENERATED,
+ UNIT_FILE_TRANSIENT);
+}
+
static int output_unit_file_list(const UnitFileList *units, unsigned c) {
_cleanup_(table_unrefp) Table *table = NULL;
- const UnitFileList *u;
+ _cleanup_(unit_file_presets_freep) UnitFilePresets presets = {};
int r;
table = table_new("unit file", "state", "vendor preset");
if (arg_full)
table_set_width(table, 0);
- for (u = units; u < units + c; u++) {
+ (void) table_set_empty_string(table, "-");
+
+ for (const UnitFileList *u = units; u < units + c; u++) {
const char *on_underline = NULL, *on_unit_color = NULL, *id;
- const char *on_preset_color = NULL, *unit_preset_str;
bool underline;
underline = u + 1 < units + c &&
UNIT_FILE_DISABLED,
UNIT_FILE_BAD))
on_unit_color = underline ? ansi_highlight_red_underline() : ansi_highlight_red();
- else if (u->state == UNIT_FILE_ENABLED)
+ else if (IN_SET(u->state,
+ UNIT_FILE_ENABLED,
+ UNIT_FILE_ALIAS))
on_unit_color = underline ? ansi_highlight_green_underline() : ansi_highlight_green();
else
on_unit_color = on_underline;
id = basename(u->path);
- r = unit_file_query_preset(arg_scope, NULL, id);
- if (r < 0) {
- unit_preset_str = "n/a";
- on_preset_color = underline ? on_underline : ansi_normal();
- } else if (r == 0) {
- unit_preset_str = "disabled";
- on_preset_color = underline ? ansi_highlight_red_underline() : ansi_highlight_red();
- } else {
- unit_preset_str = "enabled";
- on_preset_color = underline ? ansi_highlight_green_underline() : ansi_highlight_green();
- }
-
r = table_add_many(table,
TABLE_STRING, id,
- TABLE_SET_COLOR, strempty(on_underline),
+ TABLE_SET_BOTH_COLORS, strempty(on_underline),
TABLE_STRING, unit_file_state_to_string(u->state),
- TABLE_SET_COLOR, strempty(on_unit_color),
- TABLE_STRING, unit_preset_str,
- TABLE_SET_COLOR, strempty(on_preset_color));
+ TABLE_SET_BOTH_COLORS, strempty(on_unit_color));
+ if (r < 0)
+ return table_log_add_error(r);
+
+ if (show_preset_for_state(u->state)) {
+ const char *unit_preset_str, *on_preset_color;
+
+ r = unit_file_query_preset(arg_scope, arg_root, id, &presets);
+ if (r < 0) {
+ unit_preset_str = "n/a";
+ on_preset_color = underline ? on_underline : ansi_normal();
+ } else if (r == 0) {
+ unit_preset_str = "disabled";
+ on_preset_color = underline ? ansi_highlight_red_underline() : ansi_highlight_red();
+ } else {
+ unit_preset_str = "enabled";
+ on_preset_color = underline ? ansi_highlight_green_underline() : ansi_highlight_green();
+ }
+
+ r = table_add_many(table,
+ TABLE_STRING, unit_preset_str,
+ TABLE_SET_BOTH_COLORS, strempty(on_preset_color));
+ } else
+ r = table_add_many(table,
+ TABLE_EMPTY,
+ TABLE_SET_BOTH_COLORS, underline ? ansi_grey_underline() : ansi_grey());
if (r < 0)
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = output_table(table);
if (r < 0)
- return log_error_errno(r, "Failed to print the table: %m");
+ return r;
if (!arg_no_legend)
printf("\n%u unit files listed.\n", c);
if (r < 0)
return r;
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ListUnitFilesByPatterns");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "ListUnitFilesByPatterns");
if (r < 0)
return bus_log_create_error(r);
m = sd_bus_message_unref(m);
sd_bus_error_free(&error);
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ListUnitFiles");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "ListUnitFiles");
if (r < 0)
return bus_log_create_error(r);
return log_oom();
table_set_header(table, !arg_no_legend);
- if (arg_no_legend) {
- /* Hide the 'glyph' column when --no-legend is requested */
+ if (arg_plain) {
+ /* Hide the 'glyph' column when --plain is requested */
r = table_hide_column_from_display(table, 0);
if (r < 0)
return log_error_errno(r, "Failed to hide column: %m");
if (arg_full)
table_set_width(table, 0);
+ (void) table_set_empty_string(table, "-");
+
for (m = machine_infos; m < machine_infos + n; m++) {
_cleanup_free_ char *mname = NULL;
const char *on_state = "", *on_failed = "";
return table_log_add_error(r);
}
- r = table_print(table, NULL);
+ r = output_table(table);
if (r < 0)
- return log_error_errno(r, "Failed to print the table: %m");
+ return r;
if (!arg_no_legend) {
printf("\n");
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "GetDefaultTarget",
- &error,
- &reply,
- NULL);
+ r = bus_call_method(bus, bus_systemd_mgr, "GetDefaultTarget", &error, &reply, NULL);
if (r < 0)
return log_error_errno(r, "Failed to get default target: %s", bus_error_message(&error, r));
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SetDefaultTarget",
- &error,
- &reply,
- "sb", unit, 1);
+ r = bus_call_method(bus, bus_systemd_mgr, "SetDefaultTarget", &error, &reply, "sb", unit, 1);
if (r < 0)
return log_error_errno(r, "Failed to set default target: %s", bus_error_message(&error, r));
assert(bus);
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method,
- &error,
- &reply,
- "u", id);
+ r = bus_call_method(bus, bus_systemd_mgr, method, &error, &reply, "u", id);
if (r < 0)
return log_debug_errno(r, "Failed to get waiting jobs for job %" PRIu32, id);
if (arg_full)
table_set_width(table, 0);
+ (void) table_set_empty_string(table, "-");
+
for (j = jobs; j < jobs + n; j++) {
if (streq(j->state, "running"))
on = ansi_highlight();
else
on = "";
-
r = table_add_many(table,
TABLE_UINT, j->id,
TABLE_STRING, j->name,
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ListJobs",
- &error,
- &reply,
- NULL);
+ r = bus_call_method(bus, bus_systemd_mgr, "ListJobs", &error, &reply, NULL);
if (r < 0)
return log_error_errno(r, "Failed to list jobs: %s", bus_error_message(&error, r));
if (q < 0)
return log_error_errno(q, "Failed to parse job id \"%s\": %m", *name);
- q = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "CancelJob",
- &error,
- NULL,
- "u", id);
+ q = bus_call_method(bus, bus_systemd_mgr, "CancelJob", &error, NULL, "u", id);
if (q < 0) {
log_error_errno(q, "Failed to cancel job %"PRIu32": %s", id, bus_error_message(&error, q));
if (r == 0)
/* We don't use unit_dbus_path_from_name() directly since we
* don't want to load the unit if it isn't loaded. */
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "GetUnit",
- NULL,
- &reply,
- "s", unit);
+ r = bus_call_method(bus, bus_systemd_mgr, "GetUnit", NULL, &reply, "s", unit);
if (r < 0)
return r;
if (ret_dropin_paths) {
r = unit_file_find_dropin_paths(arg_root, lp->search_path, NULL,
".d", ".conf",
- names, &dropins);
+ NULL, names, &dropins);
if (r < 0)
return r;
}
_cleanup_(sd_bus_error_free) sd_bus_error enqueue_error = SD_BUS_ERROR_NULL;
/* Use the new, fancy EnqueueUnitJob() API if the user wants us to print the transaction */
- r = sd_bus_call_method(
+ r = bus_call_method(
bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
+ bus_systemd_mgr,
"EnqueueUnitJob",
&enqueue_error,
&reply,
}
if (!done) {
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method,
- error,
- &reply,
- "ss", name, mode);
+ r = bus_call_method(bus, bus_systemd_mgr, method, error, &reply, "ss", name, mode);
if (r < 0)
goto fail;
}
if (arg_wait) {
- r = sd_bus_call_method_async(
- bus,
- NULL,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "Subscribe",
- NULL, NULL,
- NULL);
+ r = bus_call_method_async(bus, NULL, bus_systemd_mgr, "Subscribe", NULL, NULL, NULL);
if (r < 0)
return log_error_errno(r, "Failed to enable subscription: %m");
if (arg_dry_run)
return 0;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "SetWallMessage",
- &error,
- NULL,
- "sb",
- m,
- !arg_no_wall);
-
+ r = bus_call_method(bus, bus_login_mgr, "SetWallMessage", &error, NULL, "sb", m, !arg_no_wall);
if (r < 0)
return log_warning_errno(r, "Failed to set wall message, ignoring: %s", bus_error_message(&error, r));
return 0;
if (arg_dry_run)
return 0;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- actions[a].method,
- &error,
- NULL,
- "b", arg_ask_password);
+ r = bus_call_method(bus, bus_login_mgr, actions[a].method, &error, NULL, "b", arg_ask_password);
if (r < 0)
return log_error_errno(r, "Failed to %s via logind: %s", actions[a].description, bus_error_message(&error, r));
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "ListInhibitors",
- NULL,
- &reply,
- NULL);
+ r = bus_call_method(bus, bus_login_mgr, "ListInhibitors", NULL, &reply, NULL);
if (r < 0)
/* If logind is not around, then there are no inhibitors... */
return 0;
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "SetRebootToFirmwareSetup",
- &error,
- NULL,
- "b", true);
+ r = bus_call_method(bus, bus_login_mgr, "SetRebootToFirmwareSetup", &error, NULL, "b", true);
if (r < 0)
return log_error_errno(r, "Cannot indicate to EFI to boot into setup mode: %s", bus_error_message(&error, r));
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "SetRebootToBootLoaderMenu",
- &error,
- NULL,
- "t", arg_boot_loader_menu);
+ r = bus_call_method(bus, bus_login_mgr, "SetRebootToBootLoaderMenu", &error, NULL, "t", arg_boot_loader_menu);
if (r < 0)
return log_error_errno(r, "Cannot indicate to boot loader to enter boot loader entry menu: %s", bus_error_message(&error, r));
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "SetRebootToBootLoaderEntry",
- &error,
- NULL,
- "s", arg_boot_loader_entry);
+ r = bus_call_method(bus, bus_login_mgr, "SetRebootToBootLoaderEntry", &error, NULL, "s", arg_boot_loader_entry);
if (r < 0)
return log_error_errno(r, "Cannot set boot into loader entry '%s': %s", arg_boot_loader_entry, bus_error_message(&error, r));
if (r < 0)
return r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SetExitCode",
- &error,
- NULL,
- "y", code);
+ r = bus_call_method(bus, bus_systemd_mgr, "SetExitCode", &error, NULL, "y", code);
if (r < 0)
return log_error_errno(r, "Failed to set exit code: %s", bus_error_message(&error, r));
if (r < 0)
return r;
- if (a == ACTION_REBOOT && argc > 1) {
- r = update_reboot_parameter_and_warn(argv[1], false);
- if (r < 0)
- return r;
+ if (a == ACTION_REBOOT) {
+ const char *arg = NULL;
+
+ if (argc > 1) {
+ if (arg_reboot_argument)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Both --reboot-argument= and positional argument passed to reboot command, refusing.");
+
+ log_notice("Positional argument to reboot command is deprecated, please use --reboot-argument= instead. Accepting anyway.");
+ arg = argv[1];
+ } else
+ arg = arg_reboot_argument;
+
+ if (arg) {
+ r = update_reboot_parameter_and_warn(arg, false);
+ if (r < 0)
+ return r;
+ }
} else if (a == ACTION_KEXEC) {
r = load_kexec_kernel();
STRV_FOREACH(name, names) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- q = sd_bus_call_method(
+ q = bus_call_method(
bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
+ bus_systemd_mgr,
"KillUnit",
&error,
NULL,
return r;
}
-static int clean_unit(int argc, char *argv[], void *userdata) {
+static int clean_or_freeze_unit(int argc, char *argv[], void *userdata) {
_cleanup_(bus_wait_for_units_freep) BusWaitForUnits *w = NULL;
_cleanup_strv_free_ char **names = NULL;
int r, ret = EXIT_SUCCESS;
char **name;
+ const char *method;
sd_bus *bus;
r = acquire_bus(BUS_FULL, &bus);
return log_error_errno(r, "Failed to allocate unit waiter: %m");
}
+ if (streq(argv[0], "clean"))
+ method = "CleanUnit";
+ else if (streq(argv[0], "freeze"))
+ method = "FreezeUnit";
+ else if (streq(argv[0], "thaw"))
+ method = "ThawUnit";
+ else
+ assert_not_reached("Unhandled method");
+
STRV_FOREACH(name, names) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL;
if (w) {
/* If we shall wait for the cleaning to complete, let's add a ref on the unit first */
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "RefUnit",
- &error,
- NULL,
- "s", *name);
+ r = bus_call_method(bus, bus_systemd_mgr, "RefUnit", &error, NULL, "s", *name);
if (r < 0) {
log_error_errno(r, "Failed to add reference to unit %s: %s", *name, bus_error_message(&error, r));
if (ret == EXIT_SUCCESS)
}
}
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "CleanUnit");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, method);
if (r < 0)
return bus_log_create_error(r);
if (r < 0)
return bus_log_create_error(r);
- r = sd_bus_message_append_strv(m, arg_clean_what);
- if (r < 0)
- return bus_log_create_error(r);
+ if (streq(method, "CleanUnit")) {
+ r = sd_bus_message_append_strv(m, arg_clean_what);
+ if (r < 0)
+ return bus_log_create_error(r);
+ }
r = sd_bus_call(bus, m, 0, &error, NULL);
if (r < 0) {
- log_error_errno(r, "Failed to clean unit %s: %s", *name, bus_error_message(&error, r));
+ log_error_errno(r, "Failed to %s unit %s: %s", argv[0], *name, bus_error_message(&error, r));
if (ret == EXIT_SUCCESS) {
ret = r;
continue;
const char *id;
const char *load_state;
const char *active_state;
+ const char *freezer_state;
const char *sub_state;
const char *unit_file_state;
const char *unit_file_preset;
bool *ellipsized) {
char since1[FORMAT_TIMESTAMP_RELATIVE_MAX], since2[FORMAT_TIMESTAMP_MAX];
- const char *s1, *s2, *active_on, *active_off, *on, *off, *ss;
+ const char *s1, *s2, *active_on, *active_off, *on, *off, *ss, *fs;
_cleanup_free_ char *formatted_path = NULL;
ExecStatusInfo *p;
usec_t timestamp;
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) &&
- !STR_IN_SET(i->unit_file_state, "generated", "transient"))
- printf(" Loaded: %s%s%s (%s; %s; vendor preset: %s)\n",
- on, strna(i->load_state), off, path, i->unit_file_state, i->unit_file_preset);
- else if (path && !isempty(i->unit_file_state))
- printf(" Loaded: %s%s%s (%s; %s)\n",
- on, strna(i->load_state), off, path, i->unit_file_state);
- else if (path)
+ else if (path && !isempty(i->unit_file_state)) {
+ bool show_preset = !isempty(i->unit_file_preset) &&
+ show_preset_for_state(unit_file_state_from_string(i->unit_file_state));
+
+ printf(" Loaded: %s%s%s (%s; %s%s%s)\n",
+ on, strna(i->load_state), off,
+ path,
+ i->unit_file_state,
+ show_preset ? "; vendor preset: " : "",
+ show_preset ? i->unit_file_preset : "");
+
+ } else if (path)
printf(" Loaded: %s%s%s (%s)\n",
on, strna(i->load_state), off, path);
else
printf(" Active: %s%s%s",
active_on, strna(i->active_state), active_off);
+ fs = !isempty(i->freezer_state) && !streq(i->freezer_state, "running") ? i->freezer_state : NULL;
+ if (fs)
+ printf(" %s(%s)%s", ansi_highlight_yellow(), fs, ansi_normal());
+
if (!isempty(i->result) && !streq(i->result, "success"))
printf(" (Result: %s)", i->result);
static const struct bus_properties_map property_map[] = {
{ "LoadState", "s", NULL, offsetof(UnitStatusInfo, load_state) },
{ "ActiveState", "s", NULL, offsetof(UnitStatusInfo, active_state) },
+ { "FreezerState", "s", NULL, offsetof(UnitStatusInfo, freezer_state) },
{ "Documentation", "as", NULL, offsetof(UnitStatusInfo, documentation) },
{}
}, status_map[] = {
{ "Id", "s", NULL, offsetof(UnitStatusInfo, id) },
{ "LoadState", "s", NULL, offsetof(UnitStatusInfo, load_state) },
{ "ActiveState", "s", NULL, offsetof(UnitStatusInfo, active_state) },
+ { "FreezerState", "s", NULL, offsetof(UnitStatusInfo, freezer_state) },
{ "SubState", "s", NULL, offsetof(UnitStatusInfo, sub_state) },
{ "UnitFileState", "s", NULL, offsetof(UnitStatusInfo, unit_file_state) },
{ "UnitFilePreset", "s", NULL, offsetof(UnitStatusInfo, unit_file_preset) },
char *u;
int r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "GetUnitByPID",
- &error,
- &reply,
- "u", pid);
+ r = bus_call_method(bus, bus_systemd_mgr, "GetUnitByPID", &error, &reply, "u", pid);
if (r < 0)
return log_error_errno(r, "Failed to get unit for PID %"PRIu32": %s", pid, bus_error_message(&error, r));
if (show_mode == SYSTEMCTL_SHOW_HELP && argc <= 1)
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
- "This command expects one or more unit names. Did you mean --help?");
+ "'help' command expects one or more unit names.\n"
+ "(Alternatively, help for systemctl itself may be shown with --help)");
r = acquire_bus(BUS_MANAGER, &bus);
if (r < 0)
polkit_agent_open_maybe();
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SetUnitProperties");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "SetUnitProperties");
if (r < 0)
return bus_log_create_error(r);
assert_not_reached("Unexpected action");
}
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method);
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, method);
if (r < 0)
return bus_log_create_error(r);
streq(argv[0], "exit") ? "Exit" :
/* poweroff */ "PowerOff";
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method,
- &error,
- NULL,
- NULL);
+ r = bus_call_method(bus, bus_systemd_mgr, method, &error, NULL, NULL);
if (r < 0 && arg_action == ACTION_SYSTEMCTL)
return log_error_errno(r, "Failed to execute operation: %s", bus_error_message(&error, r));
STRV_FOREACH(name, names) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
- q = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ResetFailedUnit",
- &error,
- NULL,
- "s", *name);
+ q = bus_call_method(bus, bus_systemd_mgr, "ResetFailedUnit", &error, NULL, "s", *name);
if (q < 0) {
log_error_errno(q, "Failed to reset failed state of unit %s: %s", *name, bus_error_message(&error, q));
if (r == 0)
(void) pager_open(arg_pager_flags);
- r = sd_bus_get_property(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "Environment",
- &error,
- &reply,
- "as");
+ r = bus_get_property(bus, bus_systemd_mgr, "Environment", &error, &reply, "as");
if (r < 0)
return log_error_errno(r, "Failed to get environment: %s", bus_error_message(&error, r));
log_debug("Switching root - root: %s; init: %s", root, strna(init));
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SwitchRoot",
- &error,
- NULL,
- "ss", root, init);
+ r = bus_call_method(bus, bus_systemd_mgr, "SwitchRoot", &error, NULL, "ss", root, init);
if (r < 0) {
(void) default_signals(SIGTERM, -1);
if (argc == 1) {
_cleanup_free_ char *level = NULL;
- r = sd_bus_get_property_string(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "LogLevel",
- &error,
- &level);
+ r = bus_get_property_string(bus, bus_systemd_mgr, "LogLevel", &error, &level);
if (r < 0)
return log_error_errno(r, "Failed to get log level: %s", bus_error_message(&error, r));
} else {
assert(argc == 2);
- r = sd_bus_set_property(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "LogLevel",
- &error,
- "s",
- argv[1]);
+ r = bus_set_property(bus, bus_systemd_mgr, "LogLevel", &error, "s", argv[1]);
if (r < 0)
return log_error_errno(r, "Failed to set log level: %s", bus_error_message(&error, r));
}
if (argc == 1) {
_cleanup_free_ char *target = NULL;
- r = sd_bus_get_property_string(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "LogTarget",
- &error,
- &target);
+ r = bus_get_property_string(bus, bus_systemd_mgr, "LogTarget", &error, &target);
if (r < 0)
return log_error_errno(r, "Failed to get log target: %s", bus_error_message(&error, r));
} else {
assert(argc == 2);
- r = sd_bus_set_property(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "LogTarget",
- &error,
- "s",
- argv[1]);
+ r = bus_set_property(bus, bus_systemd_mgr, "LogTarget", &error, "s", argv[1]);
if (r < 0)
return log_error_errno(r, "Failed to set log target: %s", bus_error_message(&error, r));
}
if (argc == 1) {
/* get ServiceWatchdogs */
- r = sd_bus_get_property_trivial(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ServiceWatchdogs",
- &error,
- 'b',
- &b);
+ r = bus_get_property_trivial(bus, bus_systemd_mgr, "ServiceWatchdogs", &error, 'b', &b);
if (r < 0)
return log_error_errno(r, "Failed to get service-watchdog state: %s", bus_error_message(&error, r));
if (b < 0)
return log_error_errno(b, "Failed to parse service-watchdogs argument: %m");
- r = sd_bus_set_property(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "ServiceWatchdogs",
- &error,
- "b",
- b);
+ r = bus_set_property(bus, bus_systemd_mgr, "ServiceWatchdogs", &error, "b", b);
if (r < 0)
return log_error_errno(r, "Failed to set service-watchdog state: %s", bus_error_message(&error, r));
}
? "SetEnvironment"
: "UnsetEnvironment";
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method);
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, method);
if (r < 0)
return bus_log_create_error(r);
polkit_agent_open_maybe();
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SetEnvironment");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "SetEnvironment");
if (r < 0)
return bus_log_create_error(r);
} else
assert_not_reached("Unknown verb");
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- method);
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, method);
if (r < 0)
return bus_log_create_error(r);
polkit_agent_open_maybe();
- r = sd_bus_message_new_method_call(
- bus,
- &m,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "AddDependencyUnitFiles");
+ r = bus_message_new_method_call(bus, &m, bus_systemd_mgr, "AddDependencyUnitFiles");
if (r < 0)
return bus_log_create_error(r);
polkit_agent_open_maybe();
- r = sd_bus_call_method(
+ r = bus_call_method(
bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
+ bus_systemd_mgr,
"PresetAllUnitFiles",
&error,
&reply,
const char *link;
int r;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "GetUnitFileLinks",
- &error,
- &reply,
- "sb", name, arg_runtime);
+ r = bus_call_method(bus, bus_systemd_mgr, "GetUnitFileLinks", &error, &reply, "sb", name, arg_runtime);
if (r < 0)
return log_error_errno(r, "Failed to get unit file links for %s: %s", name, bus_error_message(&error, r));
UNIT_FILE_ENABLED,
UNIT_FILE_ENABLED_RUNTIME,
UNIT_FILE_STATIC,
+ UNIT_FILE_ALIAS,
UNIT_FILE_INDIRECT,
UNIT_FILE_GENERATED))
enabled = true;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
const char *s;
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "GetUnitFileState",
- &error,
- &reply,
- "s", *name);
+ r = bus_call_method(bus, bus_systemd_mgr, "GetUnitFileState", &error, &reply, "s", *name);
if (r < 0)
return log_error_errno(r, "Failed to get unit file state for %s: %s", *name, bus_error_message(&error, r));
assert(state);
- r = sd_bus_get_property_string(
- sd_bus_message_get_bus(m),
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SystemState",
- NULL,
- state);
+ r = bus_get_property_string(sd_bus_message_get_bus(m), bus_systemd_mgr, "SystemState", NULL, state);
sd_event_exit(sd_bus_get_event(sd_bus_message_get_bus(m)), r);
return 0;
if (r >= 0)
r = sd_bus_attach_event(bus, event, 0);
if (r >= 0)
- r = sd_bus_match_signal_async(
+ r = bus_match_signal_async(
bus,
&slot_startup_finished,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
+ bus_systemd_mgr,
"StartupFinished",
match_startup_finished, NULL, &state);
if (r < 0) {
}
}
- r = sd_bus_get_property_string(
- bus,
- "org.freedesktop.systemd1",
- "/org/freedesktop/systemd1",
- "org.freedesktop.systemd1.Manager",
- "SystemState",
- &error,
- &state);
+ r = bus_get_property_string(bus, bus_systemd_mgr, "SystemState", &error, &state);
if (r < 0) {
log_warning_errno(r, "Failed to query system state: %s", bus_error_message(&error, r));
" kill UNIT... Send signal to processes of a unit\n"
" clean UNIT... Clean runtime, cache, state, logs or\n"
" configuration of unit\n"
+ " freeze PATTERN... Freeze execution of unit processes\n"
+ " thaw PATTERN... Resume execution of a frozen unit\n"
" is-active PATTERN... Check whether units are active\n"
" is-failed PATTERN... Check whether units are failed\n"
" status [PATTERN...|PID...] Show runtime status of one or more units\n"
" emergency Enter system emergency mode\n"
" halt Shut down and halt the system\n"
" poweroff Shut down and power-off the system\n"
- " reboot [ARG] Shut down and reboot the system\n"
+ " reboot Shut down and reboot the system\n"
" kexec Shut down and reboot the system with kexec\n"
" exit [EXIT_CODE] Request user instance or container exit\n"
" switch-root ROOT [INIT] Change to a different root file system\n"
if (r < 0)
return r;
- r = sd_bus_get_property_strv(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "BootLoaderEntries",
- &error,
- &l);
+ r = bus_get_property_strv(bus, bus_login_mgr, "BootLoaderEntries", &error, &l);
if (r < 0)
return log_error_errno(r, "Failed to enumerate boot loader entries: %s", bus_error_message(&error, r));
ARG_WITH_DEPENDENCIES,
ARG_WAIT,
ARG_WHAT,
+ ARG_REBOOT_ARG,
};
static const struct option options[] = {
{ "message", required_argument, NULL, ARG_MESSAGE },
{ "show-transaction", no_argument, NULL, 'T' },
{ "what", required_argument, NULL, ARG_WHAT },
+ { "reboot-argument", required_argument, NULL, ARG_REBOOT_ARG },
{}
};
return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
"Unknown output '%s'.",
optarg);
+
+ if (OUTPUT_MODE_IS_JSON(arg_output)) {
+ arg_no_legend = true;
+ arg_plain = true;
+ }
break;
case 'i':
break;
}
+ case ARG_REBOOT_ARG:
+ arg_reboot_argument = optarg;
+ break;
+
case '.':
/* Output an error mimicking getopt, and print a hint afterwards */
log_error("%s: invalid option -- '.'", program_invocation_name);
{ "condrestart", 2, VERB_ANY, VERB_ONLINE_ONLY, start_unit }, /* For compatibility with RH */
{ "isolate", 2, 2, VERB_ONLINE_ONLY, start_unit },
{ "kill", 2, VERB_ANY, VERB_ONLINE_ONLY, kill_unit },
- { "clean", 2, VERB_ANY, VERB_ONLINE_ONLY, clean_unit },
+ { "clean", 2, VERB_ANY, VERB_ONLINE_ONLY, clean_or_freeze_unit },
+ { "freeze", 2, VERB_ANY, VERB_ONLINE_ONLY, clean_or_freeze_unit },
+ { "thaw", 2, VERB_ANY, VERB_ONLINE_ONLY, clean_or_freeze_unit },
{ "is-active", 2, VERB_ANY, VERB_ONLINE_ONLY, check_unit_active },
{ "check", 2, VERB_ANY, VERB_ONLINE_ONLY, check_unit_active }, /* deprecated alias of is-active */
{ "is-failed", 2, VERB_ANY, VERB_ONLINE_ONLY, check_unit_failed },
{ "help", VERB_ANY, VERB_ANY, VERB_ONLINE_ONLY, show },
{ "daemon-reload", VERB_ANY, 1, VERB_ONLINE_ONLY, daemon_reload },
{ "daemon-reexec", VERB_ANY, 1, VERB_ONLINE_ONLY, daemon_reload },
- { "log-level", VERB_ANY, 2, 0, log_level },
- { "log-target", VERB_ANY, 2, 0, log_target },
- { "service-watchdogs", VERB_ANY, 2, 0, service_watchdogs },
+ { "log-level", VERB_ANY, 2, VERB_ONLINE_ONLY, log_level },
+ { "log-target", VERB_ANY, 2, VERB_ONLINE_ONLY, log_target },
+ { "service-watchdogs", VERB_ANY, 2, VERB_ONLINE_ONLY, service_watchdogs },
{ "show-environment", VERB_ANY, 1, VERB_ONLINE_ONLY, show_environment },
{ "set-environment", 2, VERB_ANY, VERB_ONLINE_ONLY, set_environment },
{ "unset-environment", 2, VERB_ANY, VERB_ONLINE_ONLY, set_environment },
{}
};
+ const Verb *verb = verbs_find_verb(argv[optind], verbs);
+ if (verb && (verb->flags & VERB_ONLINE_ONLY) && arg_root)
+ return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
+ "Verb '%s' cannot be used with --root=.",
+ argv[optind] ?: verb->verb);
+
return dispatch_verb(argc, argv, verbs, NULL);
}
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
char date[FORMAT_TIMESTAMP_MAX];
const char *action;
+ const char *log_action;
sd_bus *bus;
int r;
switch (arg_action) {
case ACTION_HALT:
action = "halt";
+ log_action = "Shutdown";
break;
case ACTION_POWEROFF:
action = "poweroff";
+ log_action = "Shutdown";
break;
case ACTION_KEXEC:
action = "kexec";
+ log_action = "Reboot via kexec";
break;
case ACTION_EXIT:
action = "exit";
+ log_action = "Shutdown";
break;
case ACTION_REBOOT:
default:
action = "reboot";
+ log_action = "Reboot";
break;
}
(void) logind_set_wall_message();
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "ScheduleShutdown",
- &error,
- NULL,
- "st",
- action,
- arg_when);
+ r = bus_call_method(bus, bus_login_mgr, "ScheduleShutdown", &error, NULL, "st", action, arg_when);
if (r < 0)
return log_warning_errno(r, "Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: %s", bus_error_message(&error, r));
if (!arg_quiet)
- log_info("Shutdown scheduled for %s, use 'shutdown -c' to cancel.", format_timestamp(date, sizeof(date), arg_when));
+ log_info("%s scheduled for %s, use 'shutdown -c' to cancel.", log_action, format_timestamp(date, sizeof(date), arg_when));
return 0;
#else
return log_error_errno(SYNTHETIC_ERRNO(ENOSYS),
(void) logind_set_wall_message();
- r = sd_bus_call_method(
- bus,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
- "CancelScheduledShutdown",
- &error,
- NULL, NULL);
+ r = bus_call_method(bus, bus_login_mgr, "CancelScheduledShutdown", &error, NULL, NULL);
if (r < 0)
return log_warning_errno(r, "Failed to talk to logind, shutdown hasn't been cancelled: %s", bus_error_message(&error, r));
int r;
setlocale(LC_ALL, "");
- log_parse_environment();
+ log_parse_environment_cli();
log_open();
/* The journal merging logic potentially needs a lot of fds. */