/sys/doc/ Documentation archive



INIT(VIII)                   2/22/74                   INIT(VIII)



NAME
     init  -  process control initialization

SYNOPSIS
     /etc/init

DESCRIPTION
     Init  is  invoked  inside  UNIX as the last step in the boot
     procedure.  Generally its role is to create  a  process  for
     each typewriter on which a user may log in.

     First,  init  checks  to see if the console switches contain
     173030.  (This number is likely to  vary  between  systems.)
     If  so, the console typewriter /dev/tty8 is opened for read-
     ing and writing and the Shell is invoked immediately.   This
     feature  is used to bring up a single-user system.  When the
     system is brought up in this way, the getty and  login  rou-
     tines  mentioned below and described elsewhere are not used.
     If the Shell terminates, init starts over  looking  for  the
     console switch setting.

     Otherwise,  init  invokes a Shell, with input taken from the
     file /etc/rc.  This command file performs housekeeping  like
     removing  temporary files, mounting file systems, and start-
     ing daemons.

     Then init reads the file /etc/ttys and forks  several  times
     to  create  a  process  for each typewriter specified in the
     file.  Each of these processes opens the  appropriate  type-
     writer for reading and writing.  These channels thus receive
     file descriptors 0 and 1, the  standard  input  and  output.
     Opening  the  typewriter will usually involve a delay, since
     the open is not completed until someone  is  dialed  up  and
     carrier  established  on  the  channel.   Then /etc/getty is
     called with argument as specified by the last  character  of
     the ttys file line.  Getty reads the user's name and invokes
     login (q.v.)  to log in the user and execute the Shell.

     Ultimately the Shell will terminate because  of  an  end-of-
     file  either  typed  explicitly  or generated 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 en-
     try from the file utmp, which  records  current  users,  and
     makes  an  entry in /usr/adm/wtmp, which maintains a history
     of logins and logouts.  Then the appropriate  typewriter  is
     reopened and getty is reinvoked.

     Init catches the hangup signal (signal #1) and interprets it
     to mean that the switches should be examined as in a reboot:
     if  they indicate a multi-user system, the /etc/ttys file is
     read again.  The Shell process on each line which used to be
     active  in  ttys but is no longer there is terminated; a new
     process is created for each added line; lines  unchanged  in
     the  file  are  undisturbed.  Thus it is possible to drop or
     add phone lines without rebooting the system by changing the


                              - 1 -




INIT(VIII)                   2/22/74                   INIT(VIII)


     ttys  file  and sending a hangup signal to the init process:
     use ``kill -1 1.''

FILES
     /dev/tty?, /etc/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc

SEE ALSO
     login(I), kill(I), sh(I), ttys(V), getty(VIII)


















































                              - 2 -