Files
oldlinux-files/Minix/2.0.0/wwwman/man8/init.8.html
2024-02-19 00:21:39 -05:00

122 lines
5.3 KiB
HTML

<HTML>
<HEAD>
<TITLE>init(8)</TITLE>
</HEAD>
<BODY>
<H1>init(8)</H1>
<HR>
<PRE>
</PRE>
<H2>NAME</H2><PRE>
init - grandparent of all processes
</PRE>
<H2>DESCRIPTION</H2><PRE>
The first program started by Minix is <STRONG>init</STRONG>. The actions performed by
<STRONG>init</STRONG> can be summarized by this pseudo shell program:
# Open 0, 1, 2.
exec &lt;/dev/null &gt;/dev/log 2&gt;&amp;1
# Run the system initialization script.
sh /etc/rc $bootopts
&gt;/etc/utmp
echo reboot &gt;&gt;/usr/adm/wtmp
while :; do
# Wait for a process to exit, but don't always block.
wait
# Record logout. (Not in this dumb way, of course.)
if "pid is in my tables" $pid
then
echo "logout $pid" &gt;/etc/utmp
echo "logout $pid" &gt;&gt;/usr/adm/wtmp
fi
# Start a new session.
while read line type getty init
do
if idle $line
then
$init ... &lt;$tty &gt;$tty
$getty &lt;$tty &gt;$tty 2&gt;&amp;1 &amp;
pid=$!
"add pid to tables" $pid
echo "login $line $pid" &gt;/etc/utmp
echo "login $line $pid" &gt;&gt;/usr/adm/wtmp
fi
done &lt; /dev/ttytab
done
The first action of <STRONG>init</STRONG> is to run <STRONG>/etc/rc</STRONG> to initialize the system as
described in <STRONG><A HREF="../man8/boot.8.html">boot(8)</A></STRONG>. <STRONG>Init</STRONG> then enters its main loop where it waits for
processes to exit, and starts processes on each enabled terminal line.
The file <STRONG>/etc/ttytab</STRONG> contains a list of terminal devices, their terminal
types, the program to execute on them to allow one to login (usually
<STRONG><A HREF="../man8/getty.8.html">getty(8)</A></STRONG>), and the program to execute first to initialize the line
(usually <STRONG><A HREF="../man1/stty.1.html">stty(1)</A></STRONG>). These fields may be left out to indicate that a line
is disabled or that initialization is not necessary. The commands are
searched using the path <STRONG>/sbin:/bin:/usr/sbin:/usr/bin</STRONG>.
<STRONG>Init</STRONG> accepts several signals that must be sent to process id 1. (It is
the first process, so natually its process id is 1.) The signals are:
<STRONG>SIGHUP</STRONG>
When receiving a hangup signal, <STRONG>init</STRONG> will forget about errors and
rescan <STRONG>ttytab</STRONG> for processes to execute. <STRONG>Init</STRONG> normally rescans
<STRONG>ttytab</STRONG> each time it feels the need to respawn a process, so the
hangup signal is only needed if a line has been shut down, or after
a terminate signal. Note that after turning a line off you will
have to kill the process running on that line manually, <STRONG>init</STRONG> doesn't
do that for you.
<STRONG>SIGTERM</STRONG>
Normally sent by programs that halt or reboot Minix. Causes <STRONG>init</STRONG> to
stop spawning new processes.
<STRONG>SIGABRT</STRONG>
Sent by the keyboard driver when the <STRONG>CTRL</STRONG>-<STRONG>ALT</STRONG>-<STRONG>DEL</STRONG> key combination is
typed. Causes <STRONG>init</STRONG> to run the <STRONG>shutdown</STRONG> command. A second abort
signal makes <STRONG>init</STRONG> halt the system directly with a system call. The
keyboard driver halts the system, without a sync, after the third
CTRL-ALT-DEL.
<STRONG>Minix</STRONG> <STRONG>vs.</STRONG> <STRONG>Minix</STRONG>-<STRONG>vmd</STRONG>
There are a few differences between standard Minix and Minix-vmd on how
<STRONG>init</STRONG> is run. The <STRONG>/etc/rc</STRONG> file is executed under standard Minix with
input connected to <STRONG>/dev/console</STRONG>, but under Minix-vmd this is still
<STRONG>/dev/null</STRONG>. This means that under Minix-vmd processes must be reconnected
to <STRONG>/dev/console</STRONG> with the <STRONG>intr</STRONG> program if they need user interaction.
Minix-vmd passes the value of the <STRONG>bootopts</STRONG> boot variable to /etc/rc.
Standard Minix does not.
</PRE>
<H2>FILES</H2><PRE>
<STRONG>/etc/ttytab</STRONG> List of terminals devices.
<STRONG>/etc/utmp</STRONG> List of currently logged in users.
<STRONG>/usr/adm/wtmp</STRONG> Login/logout history.
</PRE>
<H2>SEE ALSO</H2><PRE>
<STRONG><A HREF="../man5/ttytab.5.html">ttytab(5)</A></STRONG>, <STRONG><A HREF="../man5/utmp.5.html">utmp(5)</A></STRONG>, <STRONG><A HREF="../man8/getty.8.html">getty(8)</A></STRONG>, <STRONG><A HREF="../man1/stty.1.html">stty(1)</A></STRONG>, <STRONG><A HREF="../man8/boot.8.html">boot(8)</A></STRONG>.
</PRE>
<H2>AUTHOR</H2><PRE>
Kees J. Bot (kjb@cs.vu.nl)
</PRE>
</BODY>
</HTML>