Manual Page Result
0
Command: init | Section: 8 | Source: UNIX v10 | File: init.8
INIT(8) System Manager's Manual INIT(8)
NAME
init - process control initialization
SYNOPSIS
/etc/init
DESCRIPTION
Init is invoked by the operating system as the last step in the boot
procedure. It is always process 1.
When started normally, init calls rc(8) with parameter autoboot. If
this succeeds, init begins multi-user operation. If rc fails, init
commences single user operation by giving the super-user a shell on the
console. It is possible to pass parameters from the boot program to
init so that single user operation is commenced immediately. When the
single user shell terminates, init runs rc without the parameter, and
begins multi-user operation.
Rc performs housekeeping such as checking and mounting file systems and
starting daemons; see rc(8).
In multi-user operation, init's role is to create a process for each
directly connected terminal port on which a user may log in. To begin
such operations, it reads the ttys(5) file and forks to create a
process for each terminal specified in the file. Each of these
processes opens the appropriate terminal for reading and writing on
file descriptors 0, 1, 2, and 3 (the standard input and output, the di-
agnostic output and Opening the terminal will usually involve a delay,
since the open is not completed until someone dials and carrier is es-
tablished on the channel. Then getty(8) is called with argument as
specified by the second character of the ttys file line. Getty reads
the user's name and invokes login(8) to log in the user and execute the
shell.
Ultimately the shell will terminate because of an end-of-file or as a
result of hanging up. The main path of init, which has been waiting
for such an event, wakes up and removes the appropriate entry from the
file utmp(5), which records current users, and makes an entry in wtmp,
which maintains a history of logins and logouts. Then the appropriate
terminal is reopened and getty is invoked again.
Init catches signal SIGHUP and interprets it to mean that the ttys file
should be read again. The shell process on each line that has become
inactive according to ttys is terminated; a new process is created for
each line added; lines unchanged in the file are undisturbed. Thus it
is possible to drop or add terminal lines without rebooting the system
by changing the ttys file and sending a hangup signal to the init
process: use
Init will terminate multi-user operations, kill all outstanding
processes, and resume single-user mode if sent signal SIGTERM: use Init
will wait at most 30 seconds for outstanding processes to die, to avoid
waiting forever.
If, at bootstrap time, the init program cannot be executed, the system
will loop in user mode at a low address.
FILES
SEE ALSO
login(8), kill(1), sh(1), ttys(5), getty(8), rc(8), reboot(8)
BUGS
Init's multi-user functions should be integrated with the world of
svcmgr(8).
INIT(8)