⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 init.8

📁 操作系统设计与实现源码
💻 8
字号:
.TH INIT 8.SH NAMEinit \- grandparent of all processes.SH DESCRIPTIONThe first program started by Minix is.BR init .The actions performed by.B initcan be summarized by this pseudo shell program:.RS.nf.if t .ft C# Open 0, 1, 2.exec </dev/null >/dev/log 2>&1# Run the system initialization script.sh /etc/rc $bootopts>/etc/utmpecho reboot >>/usr/adm/wtmpwhile :; 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" >/etc/utmp		echo "logout $pid" >>/usr/adm/wtmp	fi	# Start a new session.	while read line type getty init	do		if idle $line		then			$init ... <$tty >$tty			$getty <$tty >$tty 2>&1 &			pid=$!			"add pid to tables" $pid			echo "login $line $pid" >/etc/utmp			echo "login $line $pid" >>/usr/adm/wtmp		fi	done < /dev/ttytabdone.if t .ft R.fi.REThe first action of.B initis to run.B /etc/rcto initialize the system as described in.BR boot (8)..B Initthen enters its main loop where it waits for processes to exit, and startsprocesses on each enabled terminal line.  The file.B /etc/ttytabcontains a list of terminal devices, their terminal types, the program toexecute on them to allow one to login (usually.BR getty (8)),and the program to execute first to initialize the line (usually.BR stty (1)).These fields may be left out to indicate that a line is disabled or thatinitialization is not necessary.  The commands are searched using the path.BR /sbin:/bin:/usr/sbin:/usr/bin ..PP.B Initaccepts several signals that must be sent to process id 1.  (It is the firstprocess, so natually its process id is 1.)  The signals are:.TP.B SIGHUPWhen receiving a hangup signal,.B initwill forget about errors and rescan.B ttytabfor processes to execute..B Initnormally rescans.B ttytabeach time it feels the need to respawn a process, so the hangup signal is onlyneeded if a line has been shut down, or after a terminate signal.  Notethat after turning a line off you will have to kill the process running onthat line manually,.B initdoesn't do that for you..TP.B SIGTERMNormally sent by programs that halt or reboot Minix.  Causes.B initto stop spawning new processes..TP.B SIGABRTSent by the keyboard driver when the.B CTRL-ALT-DELkey combination is typed.  Causes.B initto run the.B shutdowncommand.  A second abort signal makes.B inithalt the system directly with a system call.  The keyboard driver halts thesystem, without a sync, after the third CTRL-ALT-DEL..SS "Minix vs. Minix-vmd"There are a few differences between standard Minix and Minix-vmd on how.B initis run.  The.B /etc/rcfile is executed under standard Minix with input connected to.BR /dev/console ,but under Minix-vmd this is still.BR /dev/null .This means that under Minix-vmd processes must be reconnected to.B /dev/consolewith the.B intrprogram if they need user interaction.Minix-vmd passes the value of the.B bootoptsboot variable to /etc/rc.  Standard Minix does not..SH FILES.TP 25n.B /etc/ttytabList of terminals devices..TP.B /etc/utmpList of currently logged in users..TP.B /usr/adm/wtmpLogin/logout history..SH "SEE ALSO".BR ttytab (5),.BR utmp (5),.BR getty (8),.BR stty (1),.BR boot (8)..SH AUTHORKees J. Bot (kjb@cs.vu.nl)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -