summaryrefslogtreecommitdiff
path: root/init/reboot.h
diff options
context:
space:
mode:
authorJeremie Koenig2010-05-27 15:38:44 +0200
committerDenys Vlasenko2010-07-19 00:45:51 +0200
commit714674e4da3d92c5dd14e00ab30794a895b91eb4 (patch)
tree0d27bc73f1f2fe0175c5fc948451b86c52f9bb90 /init/reboot.h
parentf812eace1863feeac64dc8af27f4ab0f98119618 (diff)
downloadbusybox-714674e4da3d92c5dd14e00ab30794a895b91eb4.zip
busybox-714674e4da3d92c5dd14e00ab30794a895b91eb4.tar.gz
init,halt: portability improvements
* make init and halt use the same RB_* constants for reboot() * conditionalize the Linux-specific code Inspired by init.init.diff from the Debian kFreeBSD patches at: http://svn.debian.org/viewsvn/d-i/people/slackydeb/kfreebsd/busybox/1.14/debian Signed-off-by: Jeremie Koenig <jk@jk.fr.eu.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'init/reboot.h')
-rw-r--r--init/reboot.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/init/reboot.h b/init/reboot.h
new file mode 100644
index 0000000..ff045fd
--- /dev/null
+++ b/init/reboot.h
@@ -0,0 +1,31 @@
+/*
+ * Definitions related to the reboot() system call,
+ * shared between init.c and halt.c.
+ */
+
+#include <sys/reboot.h>
+
+#ifndef RB_HALT_SYSTEM
+# if defined(__linux__)
+# define RB_HALT_SYSTEM 0xcdef0123
+# define RB_ENABLE_CAD 0x89abcdef
+# define RB_DISABLE_CAD 0
+# define RB_POWER_OFF 0x4321fedc
+# define RB_AUTOBOOT 0x01234567
+# elif defined(RB_HALT)
+# define RB_HALT_SYSTEM RB_HALT
+# endif
+#endif
+
+/* Stop system and switch power off if possible. */
+#ifndef RB_POWER_OFF
+# if defined(RB_POWERDOWN)
+# define RB_POWER_OFF RB_POWERDOWN
+# elif defined(__linux__)
+# define RB_POWER_OFF 0x4321fedc
+# else
+# warning "poweroff unsupported, using halt as fallback"
+# define RB_POWER_OFF RB_HALT_SYSTEM
+# endif
+#endif
+