INIT(M) XENIX System V INIT(M)
Name
init, inir - Process control initialization.
Syntax
/etc/init
/etc/inir
Description
The init program is invoked as the last step of the boot
procedure and as the first step in enabling terminals for
user logins. init is one of three programs (init, getty(M),
and login(M)) used to initialize a system for execution.
init creates a process for each terminal on which a user may
log in. It begins by opening the console device,
/dev/console, for reading and writing. It then invokes a
shell which prompts for a password to start the system in
``maintenance mode''. If at this prompt an EOF is read, the
system proceeds toward ``multi-user mode''. If the root
pasword is entered, a shell is started and attached to the
console. When this shell is terminated the system proceeds
toward ``multi-user mode''.
If the system was automatically loaded at boot time, init
will be passed a -a flag when it is started. init also
passes this flag to the programs it runs so they may choose
to behave differently under autoboot(M) conditions.
The user may boot and the filesystem may be dirty. In this
case, inir prompts the user, asking whether to do an fsck
(C) (See fsck (C) for more information.)
The user may boot and the filesystem may be clean. In this
case, init reads commands from the /etc/rc file. This is
followed by the ``multi-user/rc" and the ``getty/login"
procedures as documented below.
``multi-user/rc" procedure: Once the filesystem is clean,
the shell terminates, and init performs several steps to
begin normal operation. It invokes a shell and reads the
commands in the /etc/rc file. This command file performs
housekeeping tasks such as removing temporary files,
mounting file systems, and starting daemons. Then it reads
the file /etc/ttys and forks several times to create a
process for each terminal device in the file. Each line in
the /etc/ttys lists the state of the line (0 for closed, 1
for open), the line mode, and the serial line (see ttys(M)).
Each process opens the appropriate serial line for reading
and writing, assigning the file descriptors 0, 1, and 2 to
the line and establishing it as the standard input, output,
and error files. If the serial line is connected to a
modem, the process delays opening the line until someone has
Page 1 (printed 8/7/87)
INIT(M) XENIX System V INIT(M)
dialed up and a carrier has been established on the line.
``getty/login" procedure: Once init has opened a line, it
executes the getty program, passing the line mode as an
argument. The getty program reads the user's name and
invokes login(M) to complete the login process (see getty(M)
for details). init waits until the user logs out by typing
ASCII end-of-file (Ctrl-D) or by hanging up. It responds by
waking up and removing the former user's login entry from
the file utmp, which records current users, and makes a new
entry in the file wtmp, which is a history of logins and
logouts. Then the corresponding line is reopened and getty
is reinvoked.
init has special responses to the hangup, interrupt, and
quit signals. The hangup signal SIGHUP causes init to
change the system from normal operation to maintenance mode.
The interrupt signal SIGINT causes init to read the ttys
file again to open any new lines and close lines that have
been removed. The quit signal SIGQUIT causes init to
disallow any further logins. In general, these signals have
a significant effect on the system and should not be used by
a inexperienced user. Instead, similar functions can be
safely performed with the enable(C), disable(C), and
shutdown(C) commands.
Files
/dev/tty*
/etc/utmp
/usr/adm/wtmp
/etc/default/boot
/etc/ttys
/etc/rc
/etc/gettydefs
See Also
autoboot(M), disable(C), enable(C), login(M), kill(C),
sh(C), shutdown(C), ttys(M), getty(M), gettydefs(F)
Diagnostics
If seven or more getty processes are started on the same
line in five minutes or less, init writes an error message
to /dev/console and refuses to start another getty on that
line for at least 30 minutes. If desired, init will try
again immediately if a SIGINT is sent.
Page 2 (printed 8/7/87)