Commit Graph

190 Commits

Author SHA1 Message Date
Eric Andersen
6fd0e31e87 Patch from Andrew Flegg:
Here's a pretty crude patch to reload /etc/inittab when init receives a
    SIGHUP. The mailing list archives weren't entirely clear on whether or
    not it should already happen, but didn't appear to be.

    The patch:
       * Adds a new function, reload_signal() which just calls
	 parse_inittab() and run_actions(RESPAWN)

       * Before entering the while (1) loop set up SIGHUP to call
	 reload_signal()

       * Modify new_init_action to skip the action if the same command
	 already exists on the same terminal

    This last bit means that changing already running entries is a bit
    hairy as you can end up with, for example, two shells running on the
    same virtual console. However, for solely adding/removing entries this patch
    seems to work quite well.
2003-07-22 09:48:56 +00:00
Eric Andersen
85e5e72bc1 Remove remaining libc5 support code 2003-07-22 08:56:55 +00:00
Eric Andersen
cb81e6484d Update a bunch of docs. Run a script to update my email addr. 2003-07-14 21:21:08 +00:00
Eric Andersen
d5a2780aa2 oops 2003-07-05 08:39:47 +00:00
Eric Andersen
3c8064ff69 Daniel writes:
I've found a problem with job control when the init process is restarted.

If the system boots for the first time, I get job control on a serial terminal -
no problems. However, when I restart init by issuing "init -q", then the shell
no longer has job control.

I traced this a problem in console_init in the file init.c. What was happening
after the restart is that the first compare

    if (ioctl(0, TIOCGSERIAL, &sr) == 0) {
	...
    } else if (ioctl(0, VT_GETSTATE, &vt) == 0) {
	...
    } else {
	... // assume /dev/console
    }

returned error and subsequently the code assumes /dev/console as the console,
which does not support job control.

Checking the errno after the first call showed that the system was complaining
about the file descriptor. This is probably because the previous init process
had closed all its file descriptors which the new init process had inherited.
2003-07-05 08:29:01 +00:00
Eric Andersen
b01ed65ad2 Apply last_patch93 from vodz:
andersen@busybox.net wrote:
    >Message: 4
    >Modified Files:
    >       init.c
    >Log Message:
    >Remove code for unsupported kernel versions

    Hmm. Current init.c have check >= 2.2.0 kernel one time too.
    Ok. Last patch removed this point and move common init code to new file for
    /init dir
2003-06-27 17:08:15 +00:00
Eric Andersen
0b0d393347 Remove bdflush garbage, which is only relevant to unsupported
kernel versions
2003-06-27 05:46:29 +00:00
Eric Andersen
2c1de61023 There have been many reports of init failing to reboot and/or failing to halt
over the years.  Well I finally took the time to track this down.  It turns out
that inside linux/kernel/sys.c the kernel will call
    machine_halt();
    do_exit(0);
when halting, or will call
    machine_power_off();
    do_exit(0);

during a reboot.  Unlike sysv init, we call reboot from within the init
process, so if the call to machine_halt() or machine_power_off() returns,                                       the call to do_exit(0) will cause the kernel to panic.  Which is a very
bad thing to happen.

So I just added this little patch to fork and call the reboot
syscall from within the forked child process, thereby neatly
avoiding the problem.

But IMHO, both calls to do_exit(0) within linux/kernel/sys.c
are bugs and should be fixed.

 -Erik
2003-04-24 11:41:28 +00:00
Manuel Novoa III
cad5364599 Major coreutils update. 2003-03-19 09:13:01 +00:00
Eric Andersen
22237017a7 Fix a silly compile error, thanks to a patch from Wen-chien Jesse Sung 2003-01-23 07:08:26 +00:00
Glenn L McGrath
b4a1baa312 Correct some init issues, update email address, last_patch78 by Vladimir
N. Oleynik
2003-01-13 22:09:50 +00:00
Eric Andersen
cf1fee06a5 Odd. I never brought this forward from bb.stable. Should handle
reaping child processes better.
 -Erik
2002-12-17 09:48:16 +00:00
Glenn L McGrath
efdd0aed23 Use error_msg instead of fprintf(stderr 2002-11-28 09:40:36 +00:00
Eric Andersen
f02c26f1ef I committed the fflush in the wrong spot. I should go to bed
earlier so I don't screw up such easy stuff.
 -Erik
2002-10-22 19:15:43 +00:00
Eric Andersen
5956028f6f Be absurdly careful about flushing stdout. 2002-10-22 11:45:20 +00:00
Eric Andersen
e8a90fb2bc After thinking about it, I think this patch from Matt Kraai is probably the
best way to go.  Sysvinit does not provide a controlling tty since it doesn't
even try to open ttys for apps.  We do.  So we should _try_ to provide a
controlling tty if possible, but we needn't freak out if it doesn't work.  This
way we won't need to use openvt or similar, we'll just have init do the Right
Thing(tm).
2002-10-12 04:05:48 +00:00
Eric Andersen
71ae64bdc6 last_patch61 from vodz:
New complex patch for decrease size devel version. Requires previous patch.
    Also removed small problems from dutmp and tar applets.
Also includes vodz' last_patch61_2:
    Last patch correcting comment for #endif and more integrated
    with libbb (very reduce size if used "cat" applet also).
    Requires last_patch61 for modutils/config.in.
2002-10-10 04:20:21 +00:00
Eric Andersen
6a9799020b Set the close-on-exec flag, just to be saf 2002-09-30 20:08:53 +00:00
Eric Andersen
a920871c3a Ignoring SIGCHLD causes a race leading to the occasional hang of init
when init will wait() on itself in waitfor() when the child exits before
init is scheduled to run.  Letting init hang is very seriously bad.
 -Erik
2002-09-25 15:08:40 +00:00
Eric Andersen
a9cc8961ed Let people run SHUTDOWN actions prior to killing everything
-Erik
2002-09-16 06:49:06 +00:00
Eric Andersen
186685d46f Patch from Thomas Gleixner <tglx@linutronix.de> to do
automatic child reaping to avoid zombies
2002-09-12 15:44:53 +00:00
Eric Andersen
1130976f8e Eliminate use of obsolete sys_errlist[]
-Erik
2002-08-26 21:36:32 +00:00
Glenn L McGrath
baf55a85fc Run through indent, fix comments 2002-08-22 18:22:10 +00:00
Eric Andersen
e707806894 Kill a silly warning 2002-07-29 08:00:16 +00:00
Eric Andersen
3bc2b206b0 Patch from Tim Riker to allow tty* in inittab if the tty
actually exists -- serial console is not the issue...
2002-07-29 06:39:58 +00:00
Eric Andersen
0826b6b0b3 This is last_patch48 from vodz. More cleanups, kills a bit
of dead code, fixes one blatent bug.
2002-07-03 23:50:16 +00:00
Eric Andersen
599e3ce163 Apply last_patch47 from vodz to fix several problems, such as the ash "job
control turned off" bug, console_setup() was called with a closed file
descriptor, setsid() inconsistancy, and silly string handling bugs.   I have
modified his patch to allow the askfirst init actions to have a controlling
terminal.
2002-07-03 11:08:10 +00:00
Eric Andersen
796446718d Fix from vodz so that complex init commands actually work 2002-07-03 05:44:18 +00:00
Eric Andersen
5222d31a15 Patch from till busch <buti@gmx.at> -- unblock all signals
in exec_signal() before calling exec()
2002-07-03 05:15:23 +00:00
Eric Andersen
d8636cad4d Doh! Remember to close /etc/inittab 2002-05-15 22:19:09 +00:00
Eric Andersen
1d1d2f9b18 Update some missing copyright notices 2002-04-13 08:31:59 +00:00
Eric Andersen
c57e42b8f0 Provide a controlling tty to askfirst processes as well
-Erik
2002-03-29 00:59:44 +00:00
Eric Andersen
b0cc0a6ca8 Rewind messages to avoid weird formatting, and fix a bug with
CONFIG_FEATURE_EXTRA_QUIET, which was broken
2002-03-20 14:57:50 +00:00
Eric Andersen
0298be88ae Update init.c per my changes in the stable branch
-Erik
2002-03-05 15:12:19 +00:00
Eric Andersen
467a18b1d9 Teach 'init -q' that init's pid may not equal 1 2002-01-25 23:13:06 +00:00
Eric Andersen
038cbc7442 Oops. 2002-01-06 01:10:25 +00:00
Eric Andersen
c94e89d81f Do not depend on PATH or getopt arg reordering 2002-01-06 01:08:28 +00:00
Matt Kraai
1f0c43668a Remove == TRUE' tests and convert != TRUE' and `== FALSE' tests to use !. 2001-12-20 23:13:26 +00:00
Eric Andersen
730f826f25 Add in a new restart init target, triggered by SIGHUP. Patch from
Russ Dill, with adjustments by me.
 -Erik
2001-12-17 23:13:08 +00:00
Eric Andersen
ed8a9be287 Patch from Dan Langlois <dan@somanetworks.com> Support SIGSTOP/SIGCONT
for wierd situations when people want init to actualy stop doing
anything for a while...
2001-11-30 19:10:58 +00:00
Eric Andersen
2480e3a30a Fix dangling comma 2001-11-21 09:05:31 +00:00
Eric Andersen
f435a918fa S390 wierdness 2001-11-20 05:42:57 +00:00
Eric Andersen
fedce06b7f Hide some ifdefs to make it more readible 2001-11-17 07:27:14 +00:00
Eric Andersen
813d88cf78 As Aaron Lehmann just pointed out, I forgot a line... 2001-10-28 22:49:48 +00:00
Eric Andersen
72f9a4277f Add in some (theoretical) uClinux support. Some init cleanups 2001-10-28 05:12:20 +00:00
Eric Andersen
bdfd0d78bc Major rework of the directory structure and the entire build system.
-Erik
2001-10-24 05:00:29 +00:00
Eric Andersen
74400ccfd0 Scrub up some function prototypes.
-Erik
2001-10-18 04:11:39 +00:00
Eric Andersen
1644db9a2b Two patches from Magick <magick@linux-fan.com>:
1st makes init smaller, and fixes a bug with AskFirst. Reading from
    /dev/null gives EOF.
    2nd makes init run the command's in the order of inittab, as in
    FIFO instead of LIFO.
2001-09-05 20:18:15 +00:00
Matt Kraai
439e3df653 Add support for devfs device names. 2001-07-23 14:52:08 +00:00
Eric Andersen
8d79ce8320 Some patches to make dietlibc work... 2001-07-22 23:00:15 +00:00