On Sat, Nov 7, 2009 at 12:37 PM, Denys Vlasenko <[email protected]> wrote: > On Friday 06 November 2009 07:19, Magnus Damm wrote: >> From: Magnus Damm <[email protected]> >> >> 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. > > Code was: > > /* Now run everything that needs to be run */ > /* First run the sysinit command */ > run_actions(SYSINIT); > check_delayed_sigs(); > /* Next run anything that wants to block */ > run_actions(WAIT); > check_delayed_sigs(); > /* 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); > > You move code which installs SIGHUP handler up, to the top > of this fragment.
Exactly. > With new code: > > If SIGHUP is caught, check_delayed_sigs() will detect it > ad call reload_inittab(). It removes all old entries, > and also all ONCE, SYSINIT and WAIT entries > (even if they come from the new iniitab), and (optionally) > kills any running processes resulted from old entries. > > In other words: > if inittab is reloaded by any SYSINIT, WAIT, or ONCE process, > all remaining SYSINIT, WAIT, or ONCE entries are ignored, > both from old and a new inittab. > > This was confusing users in the past. That's very understandable. =) > Where do you run "mdev -s" so that it wants to reload inittab? > As part of SYSINIT? When iniitab is reloaded, what > stage do you expect init to enter? Back to SYSINIT? > Continue with WAIT? or what? I let the kernel hotplug handler point to mdev, and I have a line in /etc/mdev.conf that executes a shell script which modifies the inittab and asks init to reload using "kill -HUP 1". In more detail, the shell script simply extends the inittab with a respawn getty login line for the recently added serial device. The hotplug event can happen at any time basically, but on my system it usually happens sometime during the SYSINIT phase. Today the inittab is never reloaded and that's the issue that the patch was trying to resolve. Ideally I'd like the rest of the system to stay the same during the hotplugging, ie no processes killed. Any recommendations? Thanks! / magnus _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
