From f9584254511ff497b46bc7ec6ee76d7355ef133e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 21 May 2013 16:36:51 +0200 Subject: init: remove special-case code for machines with less tham 1 MB of RAM. function old new delta init_main 920 781 -139 Signed-off-by: Denys Vlasenko --- init/init.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/init/init.c b/init/init.c index 15aad474f..f3a35d532 100644 --- a/init/init.c +++ b/init/init.c @@ -145,7 +145,7 @@ /* Default sysinit script. */ #ifndef INIT_SCRIPT -#define INIT_SCRIPT "/etc/init.d/rcS" +# define INIT_SCRIPT "/etc/init.d/rcS" #endif /* Each type of actions can appear many times. They will be @@ -640,7 +640,7 @@ static void new_init_action(uint8_t action_type, const char *command, const char /* NOTE that if CONFIG_FEATURE_USE_INITTAB is NOT defined, * then parse_inittab() simply adds in some default - * actions(i.e., runs INIT_SCRIPT and then starts a pair + * actions (i.e., runs INIT_SCRIPT and then starts a pair * of "askfirst" shells). If CONFIG_FEATURE_USE_INITTAB * _is_ defined, but /etc/inittab is missing, this * results in the same set of default behaviors. @@ -655,23 +655,22 @@ static void parse_inittab(void) #endif { /* No inittab file - set up some default behavior */ - /* Reboot on Ctrl-Alt-Del */ - new_init_action(CTRLALTDEL, "reboot", ""); - /* Umount all filesystems on halt/reboot */ - new_init_action(SHUTDOWN, "umount -a -r", ""); - /* Swapoff on halt/reboot */ - if (ENABLE_SWAPONOFF) - new_init_action(SHUTDOWN, "swapoff -a", ""); - /* Prepare to restart init when a QUIT is received */ - new_init_action(RESTART, "init", ""); + /* Sysinit */ + new_init_action(SYSINIT, INIT_SCRIPT, ""); /* Askfirst shell on tty1-4 */ new_init_action(ASKFIRST, bb_default_login_shell, ""); //TODO: VC_1 instead of ""? "" is console -> ctty problems -> angry users new_init_action(ASKFIRST, bb_default_login_shell, VC_2); new_init_action(ASKFIRST, bb_default_login_shell, VC_3); new_init_action(ASKFIRST, bb_default_login_shell, VC_4); - /* sysinit */ - new_init_action(SYSINIT, INIT_SCRIPT, ""); + /* Reboot on Ctrl-Alt-Del */ + new_init_action(CTRLALTDEL, "reboot", ""); + /* Umount all filesystems on halt/reboot */ + new_init_action(SHUTDOWN, "umount -a -r", ""); + /* Swapoff on halt/reboot */ + new_init_action(SHUTDOWN, "swapoff -a", ""); + /* Restart init when a QUIT is received */ + new_init_action(RESTART, "init", ""); return; } @@ -1058,10 +1057,13 @@ int init_main(int argc UNUSED_PARAM, char **argv) message(L_CONSOLE | L_LOG, "init started: %s", bb_banner); #endif +#if 0 +/* It's 2013, does anyone really still depend on this? */ +/* If you do, consider adding swapon to sysinot actions then! */ /* struct sysinfo is linux-specific */ -#ifdef __linux__ +# ifdef __linux__ /* Make sure there is enough memory to do something useful. */ - if (ENABLE_SWAPONOFF) { + /*if (ENABLE_SWAPONOFF) - WRONG: we may have non-bbox swapon*/ { struct sysinfo info; if (sysinfo(&info) == 0 @@ -1075,6 +1077,7 @@ int init_main(int argc UNUSED_PARAM, char **argv) run_actions(SYSINIT); /* wait and removing */ } } +# endif #endif /* Check if we are supposed to be in single user mode */ -- cgit v1.2.3