Debian Codegraph @

src/shared/reboot-util.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include <linux/reboot.h> /* IWYU pragma: export */
5 #include <sys/reboot.h> /* IWYU pragma: export */
6
7 #include "shared-forward.h"
8
9 /* glibc defines the reboot() API call, which is a wrapper around the system call of the same name, but
10 * without the extra "arg" parameter. Since we need that parameter for some calls, let's add a "raw" wrapper
11 * that is defined the same way, except it takes the additional argument. */
12 int raw_reboot(int cmd, const void *arg);
13
14 bool reboot_parameter_is_valid(const char *parameter);
15 int update_reboot_parameter_and_warn(const char *parameter, bool keep);
16
17 typedef enum RebootFlags {
18 REBOOT_LOG = 1 << 0, /* log about what we are going to do and all errors */
19 REBOOT_DRY_RUN = 1 << 1, /* return 0 right before actually doing the reboot */
20 REBOOT_FALLBACK = 1 << 2, /* fall back to plain reboot() if argument-based reboot doesn't work, isn't configured or doesn't apply otherwise */
21 } RebootFlags;
22
23 int read_reboot_parameter(char **parameter);
24 int reboot_with_parameter(RebootFlags flags);
25
26 bool shall_restore_state(void);
27
28 bool kexec_loaded(void);
29 int kexec(void);
30
31 int kexec_maybe_decompress_kernel(const char *path, int fd, int *ret_kernel_fd, int *ret_initrd_fd);
32
33 int create_shutdown_run_nologin_or_warn(void);