summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-10-08 08:21:54 +0000
committerEric Andersen <andersen@codepoet.org>2004-10-08 08:21:54 +0000
commit82baf63de5eb905ab255b4eea31e283f89f4cbf4 (patch)
tree0272388e146d81fa001889397f66930a070d96b4 /init
parent2271809d75a2df26a5afbdab1aaf0ec3623d2ce0 (diff)
downloadbusybox-w32-82baf63de5eb905ab255b4eea31e283f89f4cbf4.tar.gz
busybox-w32-82baf63de5eb905ab255b4eea31e283f89f4cbf4.tar.bz2
busybox-w32-82baf63de5eb905ab255b4eea31e283f89f4cbf4.zip
Hiroshi Ito writes:
Hello, all. Busybox init does not handle removed inittab entry correctly. # I'm sorry about my poor english, but you can find # what I would like to say from patch, isn't it? even if you apply this path, when yoy try to change a command line option in inittab, you have to do following steps. 1. remove old line from initrd 2. send HUP signal to init 3. kill old proces which is invoked from init. 4. append new line to inittab 5. send HUP signal to init, again patch is against current CVS + last patch witch I send it last.
Diffstat (limited to 'init')
-rw-r--r--init/init.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/init/init.c b/init/init.c
index 8a63ff350..0c8dc89dc 100644
--- a/init/init.c
+++ b/init/init.c
@@ -865,9 +865,11 @@ static void new_init_action(int action, const char *command, const char *cons)
865 865
866 /* Append to the end of the list */ 866 /* Append to the end of the list */
867 for (a = last = init_action_list; a; a = a->next) { 867 for (a = last = init_action_list; a; a = a->next) {
868 /* don't enter action if it's already in the list */ 868 /* don't enter action if it's already in the list,
869 * but do overwrite existing actions */
869 if ((strcmp(a->command, command) == 0) && 870 if ((strcmp(a->command, command) == 0) &&
870 (strcmp(a->terminal, cons) ==0)) { 871 (strcmp(a->terminal, cons) ==0)) {
872 a->action = action;
871 free(new_action); 873 free(new_action);
872 return; 874 return;
873 } 875 }
@@ -1047,14 +1049,33 @@ static void parse_inittab(void)
1047#endif /* CONFIG_FEATURE_USE_INITTAB */ 1049#endif /* CONFIG_FEATURE_USE_INITTAB */
1048} 1050}
1049 1051
1052#ifdef CONFIG_FEATURE_USE_INITTAB
1050static void reload_signal(int sig) 1053static void reload_signal(int sig)
1051{ 1054{
1052 message(LOG, "Reloading /etc/inittab"); 1055 struct init_action *a, *tmp;
1053 parse_inittab(); 1056
1057 message(LOG, "Reloading /etc/inittab");
1058
1059 /* disable old entrys */
1060 for (a = init_action_list; a; a = a->next ) {
1061 a->action = ONCE;
1062 }
1063
1064 parse_inittab();
1065
1066 /* remove unused entrys */
1067 for (a = init_action_list; a; a = tmp) {
1068 tmp = a->next;
1069 if (a->action & (ONCE | SYSINIT | WAIT ) &&
1070 a->pid == 0 ) {
1071 delete_init_action(a);
1072 }
1073 }
1054 run_actions(RESPAWN); 1074 run_actions(RESPAWN);
1055 return; 1075 return;
1056} 1076}
1057 1077#endif /* CONFIG_FEATURE_USE_INITTAB */
1078
1058extern int init_main(int argc, char **argv) 1079extern int init_main(int argc, char **argv)
1059{ 1080{
1060 struct init_action *a; 1081 struct init_action *a;
@@ -1145,8 +1166,13 @@ extern int init_main(int argc, char **argv)
1145 /* Next run anything to be run only once */ 1166 /* Next run anything to be run only once */
1146 run_actions(ONCE); 1167 run_actions(ONCE);
1147 1168
1169#ifdef CONFIG_FEATURE_USE_INITTAB
1148 /* Redefine SIGHUP to reread /etc/inittab */ 1170 /* Redefine SIGHUP to reread /etc/inittab */
1149 signal(SIGHUP, reload_signal); 1171 signal(SIGHUP, reload_signal);
1172#else
1173 signal(SIGHUP, SIG_IGN);
1174#endif /* CONFIG_FEATURE_USE_INITTAB */
1175
1150 1176
1151 /* Now run the looping stuff for the rest of forever */ 1177 /* Now run the looping stuff for the rest of forever */
1152 while (1) { 1178 while (1) {