diff options
author | Jeremie Koenig <jk@jk.fr.eu.org> | 2010-05-27 15:38:44 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-07-19 00:45:51 +0200 |
commit | 714674e4da3d92c5dd14e00ab30794a895b91eb4 (patch) | |
tree | 0d27bc73f1f2fe0175c5fc948451b86c52f9bb90 /init/reboot.h | |
parent | f812eace1863feeac64dc8af27f4ab0f98119618 (diff) | |
download | busybox-w32-714674e4da3d92c5dd14e00ab30794a895b91eb4.tar.gz busybox-w32-714674e4da3d92c5dd14e00ab30794a895b91eb4.tar.bz2 busybox-w32-714674e4da3d92c5dd14e00ab30794a895b91eb4.zip |
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.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/init/reboot.h b/init/reboot.h new file mode 100644 index 000000000..ff045fdd1 --- /dev/null +++ b/init/reboot.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Definitions related to the reboot() system call, | ||
3 | * shared between init.c and halt.c. | ||
4 | */ | ||
5 | |||
6 | #include <sys/reboot.h> | ||
7 | |||
8 | #ifndef RB_HALT_SYSTEM | ||
9 | # if defined(__linux__) | ||
10 | # define RB_HALT_SYSTEM 0xcdef0123 | ||
11 | # define RB_ENABLE_CAD 0x89abcdef | ||
12 | # define RB_DISABLE_CAD 0 | ||
13 | # define RB_POWER_OFF 0x4321fedc | ||
14 | # define RB_AUTOBOOT 0x01234567 | ||
15 | # elif defined(RB_HALT) | ||
16 | # define RB_HALT_SYSTEM RB_HALT | ||
17 | # endif | ||
18 | #endif | ||
19 | |||
20 | /* Stop system and switch power off if possible. */ | ||
21 | #ifndef RB_POWER_OFF | ||
22 | # if defined(RB_POWERDOWN) | ||
23 | # define RB_POWER_OFF RB_POWERDOWN | ||
24 | # elif defined(__linux__) | ||
25 | # define RB_POWER_OFF 0x4321fedc | ||
26 | # else | ||
27 | # warning "poweroff unsupported, using halt as fallback" | ||
28 | # define RB_POWER_OFF RB_HALT_SYSTEM | ||
29 | # endif | ||
30 | #endif | ||
31 | |||