Pending patches

Denys Vlasenko vda.linux at googlemail.com
Thu Nov 6 22:27:54 UTC 2008


On Thursday 06 November 2008 18:37, Vladimir Dronnikov wrote:
> > > Why then many people are coming here with "my reboot doesn't work" then?
> 
> BB reboot indeed doesn't work with runsvdir run as init.

How do you propose to make it work? What should it do
on the receipt of reboot signal?

> Either should I 
> disable reboot applet (thus losing reboot -f capability) and write reboot
> script or should I stop using runsvdir? I want to get the most from BB thus
> both the ways are unacceptable.

> To work the problem around I propose to teach runsvdir'ed init to call a
> hook script, say, /etc/reboot to perform system pre-reboot housekeeping.

I have an idea. As it stands now runsvdir has SIGHUP and SIGTERM handlers,
and we just added SIGUSR1 and SIGUSR2 if runsvdir is run under PID 1.

Getting it to handle reboot amounts simply to running a script
on any of these signals, wait for it to finish, and then
do what runsvdir does now (i.e. exit) if we are not PID 1,
else continue running. as init exiting is a bad idea.

If you want to use runsvdir as init, you run it as

runsvdir [-P] -s SCRIPT /dir

(perhaps exec'ing this command at the end of some sort
of startup script).

See attached patch. Testing...

# echo $$; exec ./busybox runsvdir ./z -s /bin/echo
17479

Simulating reboot request (in another xterm):

# kill -TERM 17479

In first xterm, "script" /bin/echo runs and prints "15"
(signo of SIGTERM), and then runsvdir exits.
--
vda
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6.patch
Type: text/x-diff
Size: 2547 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20081106/38af7b36/attachment.bin 


More information about the busybox mailing list