[PATCH] init: allow early inittab reload

Magnus Damm magnus.damm at gmail.com
Fri Nov 6 06:19:36 UTC 2009


From: Magnus Damm <damm at opensource.se>

Modify the init applet to take note of SIGHUP received during
early boot at SYSINIT or from hotplugging mdev scripts. Without
this patch SIGHUP is ignored and the inittab is never reloaded.

Useful for systems that add inittab entries from the mdev script
and reload the initttab to spawn off gettys on hotplugged devices
such as USB serial adapters.

Signed-off-by: Magnus Damm <damm at opensource.se>
---

 May have other undesired side effects, some guru should really
 double check if this simple fix is all that is needed or if
 there are better ways to do it.

 init/init.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- 0001/init/init.c
+++ work/init/init.c	2009-11-05 14:51:29.000000000 +0900
@@ -943,6 +943,12 @@ int init_main(int argc UNUSED_PARAM, cha
 		bb_signals_recursive_norestart((1 << SIGINT), record_signo);
 	}
 
+	/* Set up "reread /etc/inittab" handler.
+	 * Handler is set up without SA_RESTART, it will interrupt syscalls.
+	 */
+	if (!DEBUG_INIT && ENABLE_FEATURE_USE_INITTAB)
+		bb_signals_recursive_norestart((1 << SIGHUP), record_signo);
+
 	/* Now run everything that needs to be run */
 	/* First run the sysinit command */
 	run_actions(SYSINIT);
@@ -953,12 +959,6 @@ int init_main(int argc UNUSED_PARAM, cha
 	/* Next run anything to be run only once */
 	run_actions(ONCE);
 
-	/* Set up "reread /etc/inittab" handler.
-	 * Handler is set up without SA_RESTART, it will interrupt syscalls.
-	 */
-	if (!DEBUG_INIT && ENABLE_FEATURE_USE_INITTAB)
-		bb_signals_recursive_norestart((1 << SIGHUP), record_signo);
-
 	/* Now run the looping stuff for the rest of forever.
 	 */
 	while (1) {


More information about the busybox mailing list