shutdown: Add Xen kexec support

In the Xen case, it's the hypervisor which manages kexec. We thus
have to ask it whether a kernel is loaded, instead of relying on
/sys/kernel/kexec_loaded.
This commit is contained in:
Samuel Thibault
2022-11-02 20:47:41 +01:00
committed by Luca Boccassi
parent 23f3a6f5ff
commit ede5a78f50
15 changed files with 115 additions and 12 deletions
-9
View File
@@ -23,15 +23,6 @@ int saved_argc = 0;
char **saved_argv = NULL;
static int saved_in_initrd = -1;
bool kexec_loaded(void) {
_cleanup_free_ char *s = NULL;
if (read_one_line_file("/sys/kernel/kexec_loaded", &s) < 0)
return false;
return s[0] == '1';
}
int prot_from_flags(int flags) {
switch (flags & O_ACCMODE) {
-2
View File
@@ -19,8 +19,6 @@ static inline void save_argc_argv(int argc, char **argv) {
saved_argv = argv;
}
bool kexec_loaded(void);
int prot_from_flags(int flags) _const_;
bool in_initrd(void);