Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/init Using the `NOTES' file and source code as a refere...



details:   https://anonhg.NetBSD.org/src/rev/c8590526d4b3
branches:  trunk
changeset: 485371:c8590526d4b3
user:      lukem <lukem%NetBSD.org@localhost>
date:      Wed Apr 26 15:01:36 2000 +0000

description:
Using the `NOTES' file and source code as a reference, attempt to more
accurately explain the operation of init(8)'s state machine.

diffstat:

 sbin/init/init.8 |  97 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 71 insertions(+), 26 deletions(-)

diffs (149 lines):

diff -r c9fc0727f1d5 -r c8590526d4b3 sbin/init/init.8
--- a/sbin/init/init.8  Wed Apr 26 14:02:34 2000 +0000
+++ b/sbin/init/init.8  Wed Apr 26 15:01:36 2000 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: init.8,v 1.20 2000/03/19 23:22:07 soren Exp $
+.\"    $NetBSD: init.8,v 1.21 2000/04/26 15:01:36 lukem Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -36,7 +36,7 @@
 .\"
 .\"     @(#)init.8     8.6 (Berkeley) 5/26/95
 .\"
-.Dd May 26, 1995
+.Dd April 26, 2000
 .Dt INIT 8
 .Os BSD 4
 .Sh NAME
@@ -47,27 +47,69 @@
 .Sh DESCRIPTION
 The
 .Nm
-program is the last stage of the boot process.
-It normally runs the automatic reboot sequence as described in
-.Xr reboot 8 ,
-and if this succeeds, begins multi-user operation.
-If the reboot scripts fail,
-.Nm
-commences single user operation by giving
-the super-user a shell on the console.
+program is the last stage of the boot process (after the kernel loads
+and initializes all the devices).
+It normally begins multi-user operation.
 .Pp
-The
+The following table describes the state machine used by
+.Nm "" :
+.Bl -enum
+.It
+Single user shell.
 .Nm
-program may be passed parameters from the boot program to prevent
-the system from going multi-user and to instead execute a single
-user shell without starting the normal daemons.
-The system is then quiescent for maintenance work and may later be
-made to go to multi-user by exiting the single-user shell (with ^D).
-This causes
-.Nm
-to run the
+may be passed
+.Fl s
+from the boot program to prevent the system from going multi-user and
+to instead execute a single user shell without starting the normal
+daemons.  The system is then quiescent for maintenance work and may
+later be made to go to state 2 (multi-user) by exiting the single-user
+shell (with ^D).
+.It
+Multi-user boot (default operation).
+Executes
 .Pa /etc/rc
-start up command file in fastboot mode (skipping disk checks).
+(see
+.Xr rc 8 ) .
+If this exits with a non-zero (error) exit code, commence single user
+operation by giving the super-user a shell on the console by going to
+state 1 (single user).
+Otherwise, proceed to state 3.
+.It
+Setup ttys as specified in
+.Xr ttys 5 .
+See below for more information.
+On completion, continue to state 4.
+.It
+Multi-user operation.
+Depending upon the signal received, change state appropriately;
+on
+.Dv SIGTERM ,
+go to state 7;
+on
+.Dv SIGHUP ,
+go to state 5;
+on
+.Dv SIGTSTP ,
+go to state 6.
+.It
+Clean-up mode; re-read
+.Xr ttys 5 ,
+killing off the controlling processes on lines that are now
+.Sq off ,
+and starting processes that are newly
+.Sq on .
+On completion, go to state 4.
+.It
+.Sq Boring
+mode; no new sessions.
+Signals as per state 4.
+.It
+Shutdown mode.
+Send
+.Dv SIGHUP
+to all controlling processes, reap the processes for 30 seconds,
+and the go to state 1 (single user); warning if not all the processes died.
+.El
 .Pp
 If the
 .Sq console
@@ -107,18 +149,18 @@
 but also inhibits running
 .Xr newfs 8
 while the system is multi-user.
-
+.Pp
 The
 .Xr settimeofday 2
 system call can only advance the time.
-
-The state of 
+.Pp
+The state of
 .Xr ipf 8
 (the in-kernel IP filtering facility) may not be changed.
-
+.Pp
 Users may not change the per-process core name template format, only the
 default can be changed.
-
+.Pp
 Downgrading from highly secure mode to insecure mode (that is, to single-user
 mode) always requires the root password to be entered on the console, whether
 the console is marked as 'secure' in
@@ -185,6 +227,7 @@
 .Nm
 with the command
 .Dq Li "kill \-s HUP 1" .
+This is referenced in the table above as state 5.
 On receipt of this signal,
 .Nm
 re-reads the
@@ -193,7 +236,9 @@
 When a line is turned off in
 .Xr ttys 5 ,
 .Nm
-will send a SIGHUP signal to the controlling process
+will send a
+.Dv SIGHUP
+signal to the controlling process
 for the session associated with the line.
 For any lines that were previously turned off in the
 .Xr ttys 5



Home | Main Index | Thread Index | Old Index