[BusyBox] My plans for an init.c patch to make ids & reloading different.
Tom Oehser
tom at toms.net
Fri Apr 26 22:08:03 UTC 2002
Well, I'm hacking away at init.c.
Until very recently, I pretty much *had* to use sysvinit for other
reasons, that is, busybox was on /usr, and I didn't want another one
just for init. But now, with tomsrtbt-2.x.x, it is all together on one
root, so I thought, "great, now I can replace sysvinit with busybox".
After all, I don't care about runlevels, or most of the other stuff...
My problem is that the /etc/inittab in tomsrtbt is buried in a bzip2
compressed minix filesystem, so for adding something to it I have
(had) users put something like:
cat>/dev/inittab<<!
c7:5:respawn:/usr/bin/nc -l -p 23 -e /usr/bin/telnetd
!
kill -HUP 1
But, that happens *from an inittab started script*. Which obviously
would do bad things given the way busybox init handles HUP.
Basically, I want to be able to add actions after init is running,
*without* side effects on running actions.
If I use the current (undocumented) "restart" "-q", it completely
restarts init, which of course restarts the cat, etc... and doesn't
allow adding one line and starting that, etc. (Also, there seems to
be a bug where it only works once, maybe leaving the signals set
wrong for the second time, but that is not important to me, given
that the whole 'restart' scheme is not what I want.
SO, here is what I'm going to do. With a good bit of thought towards
compatibility with both busybox AND sysvinit.
- Move the "restart" thing in situ to "SIGURG" and "-r".
- Make SIGHUP and -q perform reload of inittab, ala sysvinit.
In order to keep compatibility with busybox 'tty' IDs,
The format will be to make the ID field somewhat trickier:
tty1::respawn:/etc/test.sh
interpreted as the TTY _and_ as the ID for reload purposes
12::respawn:/etc/test.sh
interpreted as ID _only_ because /dev/12 doesn't exist
(means that instead of errors, it will use 12 as ID and
act as though tty is the console)
12;tty1::respawn:/etc/test.sh
interpreted with the ID as "12" and the TTY as /dev/tty1
(allows for multiple IDs to use the same console, just for kicks)
Notes/Plans/Caveats:
- It will save the ID with the action
- On HUP or -q, it will re-parse the inittab
- It will ignore entries with an ID that exists in actions
- It will add and run entries with an ID that isn't there
- My initial implementation may only do add, not delete
I think this will preserve complete compatibility with the existing
busybox inittab format. It will of course break anything that depends
on a HUP/-q to perform a "restart", but will leave that stuff on URG/-r.
What I'm looking for is feedback most importantly on whether anyone is
using the "restart" HUP/-q hack, as I don't think this scheme will break
anything else.
-Tom
More information about the busybox
mailing list