c52a937b46
This mimics the raw_clone() call we have in place already and establishes a new syscall wrapper raw_reboot() that wraps the kernel's reboot() system call in a bit more low-level fashion that glibc's reboot() wrapper. The main difference is that the extra "arg" argument is supported. Ultimately this just replaces the syscall wrapper implementation we currently have at three places in our codebase by a single one. With this change this means that all our syscall() invocations are neatly separated out in static inline system call wrappers in our header functions.
15 lines
575 B
C
15 lines
575 B
C
/* 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);
|
|
}
|