diff options
author | Ed Schouten <ed@FreeBSD.org> | 2012-03-14 16:22:09 +0000 |
---|---|---|
committer | Ed Schouten <ed@FreeBSD.org> | 2012-03-14 16:22:09 +0000 |
commit | 4c2c7b2c9461801cdc2b12fb342d39207e92c445 (patch) | |
tree | dea6cb77cabd12edd47299949ca72888b2ddeae7 /sbin/init/init.8 | |
parent | 93bd0cdedd5ef285de4a7540281a0382d759e4fc (diff) | |
download | src-4c2c7b2c9461801cdc2b12fb342d39207e92c445.tar.gz src-4c2c7b2c9461801cdc2b12fb342d39207e92c445.zip |
Make init(8) slightly more robust when /dev/console is missing.
If the environment doesn't offer a working /dev/console, the existing
version of init(8) will simply refuse running rc(8) scripts. This means
you'll only have a system running init(8) and nothing else.
Change the code to do the following:
- Open /dev/console like we used to do, but make it more robust to use
O_NONBLOCK to prevent blocking on a carrier.
- If this fails, use /dev/null as stdin and /var/log/init.log as stdout
and stderr.
- If even this fails, use /dev/null as stdin, stdout and stderr.
So why us this useful? Well, if you remove the `getpid() == 1' check in
main(), you can now use init(8) inside jails to properly execute rc(8).
It still requires some polishing, as existing tools assume init(8) has
PID 1.
Also it is now possible to use use init(8) on `headless' devices that
don't even have a serial boot console.
Notes
Notes:
svn path=/head/; revision=232977
Diffstat (limited to 'sbin/init/init.8')
-rw-r--r-- | sbin/init/init.8 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sbin/init/init.8 b/sbin/init/init.8 index 1d7bc2e78403..fa9f7f0df8e4 100644 --- a/sbin/init/init.8 +++ b/sbin/init/init.8 @@ -31,7 +31,7 @@ .\" @(#)init.8 8.3 (Berkeley) 4/18/94 .\" $FreeBSD$ .\" -.Dd February 11, 2012 +.Dd March 14, 2012 .Dt INIT 8 .Os .Sh NAME @@ -293,22 +293,22 @@ as follows: file .El .Sh FILES -.Bl -tag -width /etc/rc.shutdown -compact +.Bl -tag -width /var/log/init.log -compact .It Pa /dev/console system console device .It Pa /dev/tty* terminal ports found in .Xr ttys 5 -.It Pa /var/run/utx.active -record of current users on the system -.It Pa /var/log/utx.log -record of all logins and logouts .It Pa /etc/ttys the terminal initialization information file .It Pa /etc/rc system startup commands .It Pa /etc/rc.shutdown system shutdown commands +.It Pa /var/log/init.log +log of +.Xr rc 8 +output if the system console device is not available .El .Sh DIAGNOSTICS .Bl -diag |