source: trunk/minix/man/man8/init.8@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 3.3 KB
Line 
1.TH INIT 8
2.SH NAME
3init \- grandparent of all processes
4.SH DESCRIPTION
5The first program started by MINIX 3 is
6.BR init .
7The actions performed by
8.B init
9can be summarized by this pseudo shell program:
10.RS
11.nf
12.if t .ft C
13
14# Open 0, 1, 2.
15exec </dev/null >/dev/log 2>&1
16
17# Run the system initialization script.
18sh /etc/rc $bootopts
19
20>/etc/utmp
21echo reboot >>/usr/adm/wtmp
22
23while :; do
24 # Wait for a process to exit, but don't always block.
25 wait
26
27 # Record logout. (Not in this dumb way, of course.)
28 if "pid is in my tables" $pid
29 then
30 echo "logout $pid" >/etc/utmp
31 echo "logout $pid" >>/usr/adm/wtmp
32 fi
33
34 # Start a new session.
35 while read line type getty init
36 do
37 if idle $line
38 then
39 $init ... <$tty >$tty
40 $getty <$tty >$tty 2>&1 &
41 pid=$!
42 "add pid to tables" $pid
43 echo "login $line $pid" >/etc/utmp
44 echo "login $line $pid" >>/usr/adm/wtmp
45 fi
46 done < /dev/ttytab
47done
48
49.if t .ft R
50.fi
51.RE
52The first action of
53.B init
54is to run
55.B /etc/rc
56to initialize the system as described in
57.BR boot (8).
58.B Init
59then enters its main loop where it waits for processes to exit, and starts
60processes on each enabled terminal line. The file
61.B /etc/ttytab
62contains a list of terminal devices, their terminal types, the program to
63execute on them to allow one to login (usually
64.BR getty (8)),
65and the program to execute first to initialize the line (usually
66.BR stty (1)).
67These fields may be left out to indicate that a line is disabled or that
68initialization is not necessary. The commands are searched using the path
69.BR /sbin:/bin:/usr/sbin:/usr/bin .
70.PP
71.B Init
72accepts several signals that must be sent to process id 1. (It is the first
73process, so natually its process id is 1.) The signals are:
74.TP
75.B SIGHUP
76When receiving a hangup signal,
77.B init
78will forget about errors and rescan
79.B ttytab
80for processes to execute.
81.B Init
82normally rescans
83.B ttytab
84each time it feels the need to respawn a process, so the hangup signal is only
85needed if a line has been shut down, or after a terminate signal. Note
86that after turning a line off you will have to kill the process running on
87that line manually,
88.B init
89doesn't do that for you.
90.TP
91.B SIGTERM
92Normally sent by programs that halt or reboot MINIX 3. Causes
93.B init
94to stop spawning new processes.
95.TP
96.B SIGABRT
97Sent by the keyboard driver when the
98.B CTRL-ALT-DEL
99key combination is typed. Causes
100.B init
101to run the
102.B shutdown
103command. A second abort signal makes
104.B init
105halt the system directly with a system call. The keyboard driver halts the
106system, without a sync, after the third CTRL-ALT-DEL.
107.SS "MINIX 3 vs. Minix-vmd"
108There are a few differences between standard MINIX 3 and Minix-vmd on how
109.B init
110is run. The
111.B /etc/rc
112file is executed under standard MINIX 3 with input connected to
113.BR /dev/console ,
114but under Minix-vmd this is still
115.BR /dev/null .
116This means that under Minix-vmd processes must be reconnected to
117.B /dev/console
118with the
119.BR intr (8)
120program if they need user interaction.
121Minix-vmd passes the value of the
122.B bootopts
123boot variable to /etc/rc. Standard MINIX 3 does not.
124.SH FILES
125.TP 25n
126.B /etc/ttytab
127List of terminals devices.
128.TP
129.B /etc/utmp
130List of currently logged in users.
131.TP
132.B /usr/adm/wtmp
133Login/logout history.
134.SH "SEE ALSO"
135.BR ttytab (5),
136.BR utmp (5),
137.BR getty (8),
138.BR stty (1),
139.BR boot (8).
140.SH AUTHOR
141Kees J. Bot (kjb@cs.vu.nl)
Note: See TracBrowser for help on using the repository browser.