From 4f3f757d56fbf420ea5030dcf7ea971b3da3ab47 Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Fri, 28 Apr 2000 00:18:56 +0000 Subject: Latest and greatest. Some effort at libc5 (aiming towards newlib) compatability. -Erik --- init/init.c | 61 +++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 18 deletions(-) (limited to 'init') diff --git a/init/init.c b/init/init.c index af10f98f0..29d8f48f9 100644 --- a/init/init.c +++ b/init/init.c @@ -28,31 +28,50 @@ */ #include "internal.h" -#include +#include +#include #include -#include /* for serial_struct */ -#include #include #include #include -#include -#include #include +#include +#include +#include +#include /* for serial_struct */ +#include +#include +#include +#include /* For check_free_memory() */ #include #include -#include #include -#include -#include /* For check_free_memory() */ -#ifdef BB_SYSLOGD -# include -#endif #include #include #include /* for vt_stat */ #include -#include -#include +#ifdef BB_SYSLOGD +# include +#endif + + +#ifndef RB_HALT_SYSTEM +#define RB_HALT_SYSTEM 0xcdef0123 +#define RB_ENABLE_CAD 0x89abcdef +#define RB_DISABLE_CAD 0 +#define RB_POWER_OFF 0x4321fedc +#define RB_AUTOBOOT 0x01234567 +#if defined(__GLIBC__) +#include + #define init_reboot(magic) reboot(magic) +#else + #define init_reboot(magic) reboot(0xfee1dead, 672274793, magic) +#endif +#endif + +#ifndef _PATH_STDPATH +#define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin" +#endif #if defined BB_FEATURE_INIT_COREDUMPS @@ -71,6 +90,12 @@ #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) #endif +#if defined(__GLIBC__) +#include +#else +_syscall2(int, bdflush, int, func, int, data); +#endif /* __GLIBC__ */ + #define VT_PRIMARY "/dev/tty1" /* Primary virtual console */ #define VT_SECONDARY "/dev/tty2" /* Virtual console */ @@ -510,7 +535,7 @@ static void shutdown_system(void) signal(SIGHUP, SIG_DFL); /* Allow Ctrl-Alt-Del to reboot system. */ - reboot(RB_ENABLE_CAD); + init_reboot(RB_ENABLE_CAD); message(CONSOLE|LOG, "\r\nThe system is going down NOW !!\r\n"); sync(); @@ -550,10 +575,10 @@ static void halt_signal(int sig) #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0) if (sig == SIGUSR2) - reboot(RB_POWER_OFF); + init_reboot(RB_POWER_OFF); else #endif - reboot(RB_HALT_SYSTEM); + init_reboot(RB_HALT_SYSTEM); exit(0); } @@ -566,7 +591,7 @@ static void reboot_signal(int sig) /* allow time for last message to reach serial console */ sleep(2); - reboot(RB_AUTOBOOT); + init_reboot(RB_AUTOBOOT); exit(0); } @@ -852,7 +877,7 @@ extern int init_main(int argc, char **argv) /* Turn off rebooting via CTL-ALT-DEL -- we get a * SIGINT on CAD so we can shut things down gracefully... */ - reboot(RB_DISABLE_CAD); + init_reboot(RB_DISABLE_CAD); #endif /* Figure out what kernel this is running */ -- cgit v1.2.3