ratelimit.c
ratelimit.h
raw-clone.h
+ raw-reboot.h
refcnt.h
replace-var.c
replace-var.h
--- /dev/null
+/* SPDX-License-Identifier: LGPL-2.1+ */
+#pragma once
+
+#include <linux/reboot.h>
+#include <sys/reboot.h>
+#include <sys/syscall.h>
+
+/* glibc defines the reboot() API call, which is a wrapper around the system call of the same name, but without the
+ * extra "arg" parameter. Since we need that parameter for some calls, let's add a "raw" wrapper that is defined the
+ * same way, except it takes the additional argument. */
+
+static inline int raw_reboot(int cmd, const void *arg) {
+ return (int) syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, arg);
+}
***/
#include <sys/reboot.h>
-#include <linux/reboot.h>
#include "bus-error.h"
#include "bus-util.h"
#include "emergency-action.h"
+#include "raw-reboot.h"
#include "special.h"
#include "string-table.h"
#include "terminal-util.h"
if (!isempty(reboot_arg)) {
log_info("Rebooting with argument '%s'.", reboot_arg);
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, reboot_arg);
+ (void) raw_reboot(LINUX_REBOOT_CMD_RESTART2, reboot_arg);
log_warning_errno(errno, "Failed to reboot with parameter, retrying without: %m");
}
#include <errno.h>
#include <getopt.h>
-#include <linux/reboot.h>
#include <signal.h>
#include <stdbool.h>
#include <stdlib.h>
#include "missing.h"
#include "parse-util.h"
#include "process-util.h"
+#include "raw-reboot.h"
#include "signal-util.h"
#include "string-util.h"
#include "switch-root.h"
if (!isempty(param)) {
log_info("Rebooting with argument '%s'.", param);
- syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_RESTART2, param);
+ (void) raw_reboot(LINUX_REBOOT_CMD_RESTART2, param);
log_warning_errno(errno, "Failed to reboot with parameter, retrying without: %m");
}
}
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
-#include <linux/reboot.h>
#include <locale.h>
#include <stdbool.h>
#include <stddef.h>
#include "format-util.h"
#include "fs-util.h"
#include "glob-util.h"
-#include "hostname-util.h"
#include "hexdecoct.h"
+#include "hostname-util.h"
#include "initreq.h"
#include "install.h"
#include "io-util.h"
#include "path-lookup.h"
#include "path-util.h"
#include "process-util.h"
+#include "raw-reboot.h"
#include "rlimit-util.h"
#include "set.h"
#include "sigbus.h"
if (!arg_quiet)
log_info("Rebooting with argument '%s'.", param);
if (!arg_dry_run) {
- (void) syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
- LINUX_REBOOT_CMD_RESTART2, param);
+ (void) raw_reboot(LINUX_REBOOT_CMD_RESTART2, param);
log_warning_errno(errno, "Failed to reboot with parameter, retrying without: %m");
}
}