diff options
Diffstat (limited to 'init/init.c')
-rw-r--r-- | init/init.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/init/init.c b/init/init.c index 1388c75cc..d8bf15894 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include "libbb.h" | 12 | #include "libbb.h" |
13 | #include <syslog.h> | 13 | #include <syslog.h> |
14 | #include <paths.h> | 14 | #include <paths.h> |
15 | #include <sys/reboot.h> | ||
16 | #include <sys/resource.h> | 15 | #include <sys/resource.h> |
17 | #ifdef __linux__ | 16 | #ifdef __linux__ |
18 | #include <linux/vt.h> | 17 | #include <linux/vt.h> |
@@ -20,6 +19,7 @@ | |||
20 | #if ENABLE_FEATURE_UTMP | 19 | #if ENABLE_FEATURE_UTMP |
21 | # include <utmp.h> /* DEAD_PROCESS */ | 20 | # include <utmp.h> /* DEAD_PROCESS */ |
22 | #endif | 21 | #endif |
22 | #include "reboot.h" /* reboot() constants */ | ||
23 | 23 | ||
24 | /* Used only for sanitizing purposes in set_sane_term() below. On systems where | 24 | /* Used only for sanitizing purposes in set_sane_term() below. On systems where |
25 | * the baud rate is stored in a separate field, we can safely disable them. */ | 25 | * the baud rate is stored in a separate field, we can safely disable them. */ |
@@ -97,13 +97,6 @@ static const char *log_console = VC_5; | |||
97 | enum { | 97 | enum { |
98 | L_LOG = 0x1, | 98 | L_LOG = 0x1, |
99 | L_CONSOLE = 0x2, | 99 | L_CONSOLE = 0x2, |
100 | #ifndef RB_HALT_SYSTEM | ||
101 | RB_HALT_SYSTEM = 0xcdef0123, /* FIXME: this overflows enum */ | ||
102 | RB_ENABLE_CAD = 0x89abcdef, | ||
103 | RB_DISABLE_CAD = 0, | ||
104 | RB_POWER_OFF = 0x4321fedc, | ||
105 | RB_AUTOBOOT = 0x01234567, | ||
106 | #endif | ||
107 | }; | 100 | }; |
108 | 101 | ||
109 | /* Print a message to the specified device. | 102 | /* Print a message to the specified device. |
@@ -724,10 +717,12 @@ static void restart_handler(int sig UNUSED_PARAM) | |||
724 | 717 | ||
725 | run_shutdown_and_kill_processes(); | 718 | run_shutdown_and_kill_processes(); |
726 | 719 | ||
720 | #ifdef RB_ENABLE_CAD | ||
727 | /* Allow Ctrl-Alt-Del to reboot the system. | 721 | /* Allow Ctrl-Alt-Del to reboot the system. |
728 | * This is how kernel sets it up for init, we follow suit. | 722 | * This is how kernel sets it up for init, we follow suit. |
729 | */ | 723 | */ |
730 | reboot(RB_ENABLE_CAD); /* misnomer */ | 724 | reboot(RB_ENABLE_CAD); /* misnomer */ |
725 | #endif | ||
731 | 726 | ||
732 | if (open_stdio_to_tty(a->terminal)) { | 727 | if (open_stdio_to_tty(a->terminal)) { |
733 | dbg_message(L_CONSOLE, "Trying to re-exec %s", a->command); | 728 | dbg_message(L_CONSOLE, "Trying to re-exec %s", a->command); |
@@ -870,9 +865,11 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
870 | ) { | 865 | ) { |
871 | bb_show_usage(); | 866 | bb_show_usage(); |
872 | } | 867 | } |
868 | #ifdef RB_DISABLE_CAD | ||
873 | /* Turn off rebooting via CTL-ALT-DEL - we get a | 869 | /* Turn off rebooting via CTL-ALT-DEL - we get a |
874 | * SIGINT on CAD so we can shut things down gracefully... */ | 870 | * SIGINT on CAD so we can shut things down gracefully... */ |
875 | reboot(RB_DISABLE_CAD); /* misnomer */ | 871 | reboot(RB_DISABLE_CAD); /* misnomer */ |
872 | #endif | ||
876 | } | 873 | } |
877 | 874 | ||
878 | /* Figure out where the default console should be */ | 875 | /* Figure out where the default console should be */ |
@@ -895,6 +892,8 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
895 | message(L_CONSOLE | L_LOG, "init started: %s", bb_banner); | 892 | message(L_CONSOLE | L_LOG, "init started: %s", bb_banner); |
896 | #endif | 893 | #endif |
897 | 894 | ||
895 | /* struct sysinfo is linux-specific */ | ||
896 | #ifdef __linux__ | ||
898 | /* Make sure there is enough memory to do something useful. */ | 897 | /* Make sure there is enough memory to do something useful. */ |
899 | if (ENABLE_SWAPONOFF) { | 898 | if (ENABLE_SWAPONOFF) { |
900 | struct sysinfo info; | 899 | struct sysinfo info; |
@@ -910,6 +909,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) | |||
910 | run_actions(SYSINIT); /* wait and removing */ | 909 | run_actions(SYSINIT); /* wait and removing */ |
911 | } | 910 | } |
912 | } | 911 | } |
912 | #endif | ||
913 | 913 | ||
914 | /* Check if we are supposed to be in single user mode */ | 914 | /* Check if we are supposed to be in single user mode */ |
915 | if (argv[1] | 915 | if (argv[1] |