Asri-unix.423 net.unix-wizards utzoo!decvax!ucbvax!menlo70!sri-unix!ucla-vax!wales@Berkeley Mon Jan 4 19:45:03 1982 /etc/rc, /dev/console, and the C shell RE: Consequences of changing "init" to make /etc/rc a C-shell file and give it /dev/console as its stdin/stdout/stderr I while ago I asked for comments about the above suggestions. I went ahead and implemented them about a week ago. It seems to work fine. The first immediate benefits of doing this were that I was able to take advantage of the C shell's nicer (in my opinion, at least) control syntax, and I didn't need to write ">/dev/console" at the end of practically every line. Further, I was able to make the following nice additions to /etc/rc: (1) We are running 4.1BSD and thus have the automatic reboot facility with "fsck -p". If /etc/rc is invoked without an auto-reboot being indicated, I query the operator as follows (remember that "init" passes the argument "autoboot" to the /etc/rc shell when an auto- reboot is desired): if ($#argv == 0) then echo -n ^G^G^G^GCheck file systems? '' set XX = $/dev/console" did.) Several people warned of problems relating to the assignment of process groups. I haven't had any difficulties here. "update", "cron", and the other daemons spun off by /etc/rc end up in a process group equal to the PID of the shell which executed /etc/rc. This PID is NOT the same as that of any login shell subsequently created on /dev/console, and "newproc" (sys/slp.c) never reuses a PID that is an active process group ID, so my daemons can't be affected by anyone doing interrupts, quits, or "kill 0" from any process or any terminal (even the console). As for a daemon's not being able to establish its own process group, 4.1BSD does have a "setpgrp" system call, so a daemon could set its process group ID equal to its process ID if it really cared to. As for the idea that "there may not be a /dev/console, but there'll always be a /" -- a little thought should make it clear that you're in REAL deep yogurt unless you have /dev/console, because every line in /etc/rc that redirects output to the console will bomb out (including the "fsck -p", so auto-reboot fails), and the single-user shell spun off by "init" is going to be a great help without a console to talk to!! Since I've GOTTA have a /dev/console on my system to do anything at all, then, I lose nothing by having /etc/rc talk to it by default. -- Rich ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.