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>
This commit is contained in:
Jeremie Koenig
2010-05-27 15:38:44 +02:00
committed by Denys Vlasenko
parent f812eace18
commit 714674e4da
4 changed files with 40 additions and 23 deletions

View File

@@ -8,7 +8,7 @@
*/
#include "libbb.h"
#include <sys/reboot.h>
#include "reboot.h"
#if ENABLE_FEATURE_WTMP
#include <sys/utsname.h>
@@ -36,18 +36,6 @@ static void write_wtmp(void)
#define write_wtmp() ((void)0)
#endif
#ifndef RB_HALT_SYSTEM
#define RB_HALT_SYSTEM RB_HALT
#endif
#ifndef RB_POWERDOWN
/* Stop system and switch power off if possible. */
# define RB_POWERDOWN 0x4321fedc
#endif
#ifndef RB_POWER_OFF
# define RB_POWER_OFF RB_POWERDOWN
#endif
int halt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int halt_main(int argc UNUSED_PARAM, char **argv)