summaryrefslogtreecommitdiff
path: root/tools/include/nolibc
diff options
context:
space:
mode:
authorZhangjin Wu <falcon@tinylab.org>2023-07-08 02:29:30 +0800
committerWilly Tarreau <w@1wt.eu>2023-08-23 04:38:02 +0200
commit788aca91ab5e4cccae158aac03a1d653c6da2fde (patch)
treeede376fea818fdd8e5f7ba1904ad1295e84b7191 /tools/include/nolibc
parent989abf1c7bc590969ef1b19b8e64b69423bfacc7 (diff)
tools/nolibc: types.h: add RB_ flags for reboot()
Both glibc and musl provide RB_ flags via <sys/reboot.h> for reboot(), they don't need to include <linux/reboot.h>, let nolibc provide RB_ flags too. Signed-off-by: Zhangjin Wu <falcon@tinylab.org> Signed-off-by: Willy Tarreau <w@1wt.eu>
Diffstat (limited to 'tools/include/nolibc')
-rw-r--r--tools/include/nolibc/sys.h1
-rw-r--r--tools/include/nolibc/types.h12
2 files changed, 11 insertions, 2 deletions
diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h
index 61a3204b00d7..804bc0231ec7 100644
--- a/tools/include/nolibc/sys.h
+++ b/tools/include/nolibc/sys.h
@@ -21,7 +21,6 @@
#include <linux/auxvec.h>
#include <linux/fcntl.h> /* for O_* and AT_* */
#include <linux/stat.h> /* for statx() */
-#include <linux/reboot.h> /* for LINUX_REBOOT_* */
#include <linux/prctl.h>
#include "arch.h"
diff --git a/tools/include/nolibc/types.h b/tools/include/nolibc/types.h
index 5e1bac8509ec..23963e48d8ee 100644
--- a/tools/include/nolibc/types.h
+++ b/tools/include/nolibc/types.h
@@ -9,8 +9,9 @@
#include "std.h"
#include <linux/mman.h>
-#include <linux/time.h>
+#include <linux/reboot.h> /* for LINUX_REBOOT_* */
#include <linux/stat.h>
+#include <linux/time.h>
/* Only the generic macros and types may be defined here. The arch-specific
@@ -92,6 +93,15 @@
#define SEEK_CUR 1
#define SEEK_END 2
+/* flags for reboot */
+#define RB_AUTOBOOT LINUX_REBOOT_CMD_RESTART
+#define RB_HALT_SYSTEM LINUX_REBOOT_CMD_HALT
+#define RB_ENABLE_CAD LINUX_REBOOT_CMD_CAD_ON
+#define RB_DISABLE_CAD LINUX_REBOOT_CMD_CAD_OFF
+#define RB_POWER_OFF LINUX_REBOOT_CMD_POWER_OFF
+#define RB_SW_SUSPEND LINUX_REBOOT_CMD_SW_SUSPEND
+#define RB_KEXEC LINUX_REBOOT_CMD_KEXEC
+
/* Macros used on waitpid()'s return status */
#define WEXITSTATUS(status) (((status) & 0xff00) >> 8)
#define WIFEXITED(status) (((status) & 0x7f) == 0)