Files
systemd/src/sysupdate/sysupdate-util.c
Daan De Meyer 93a1f7921a basic: Stop including log.h in macro.h
Now that the necessary functions from log.h have been moved to macro.h,
we can stop including log.h in macro.h. This requires modifying source
files all over the tree to include log.h instead.
2025-04-18 14:19:15 +02:00

28 lines
813 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sd-bus.h"
#include "bus-error.h"
#include "bus-locator.h"
#include "log.h"
#include "login-util.h"
#include "sysupdate-util.h"
int reboot_now(void) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_close_unrefp) sd_bus *bus = NULL;
int r;
r = sd_bus_open_system(&bus);
if (r < 0)
return log_error_errno(r, "Failed to open bus connection: %m");
r = bus_call_method(bus, bus_login_mgr, "RebootWithFlags", &error, NULL, "t",
(uint64_t) SD_LOGIND_ROOT_CHECK_INHIBITORS);
if (r < 0)
return log_error_errno(r, "Failed to issue reboot request: %s", bus_error_message(&error, r));
return 0;
}