/etc/rc: stdin/stdout/stderr to /dev/console?

utzoo!decvax!ucbvax!menlo70!sri-unix!dan at BBN-UNIX utzoo!decvax!ucbvax!menlo70!sri-unix!dan at BBN-UNIX
Wed Dec 30 23:36:30 AEST 1981


From: Dan Franklin <dan at BBN-UNIX>
We changed our init to redirect stdin,stdout,stderr to the console
on our 11/70 UNIX system here at BBN several years ago, and found it
very useful (especially since we were running the V6 shell at the time, and so
couldn't even redirect stderr!). You can avoid having /etc/rc commands
respond to interrupt by changing init (or your /etc/rc, under V7) to
ignore interrupt and quit at the same time that you put in the change to use
/dev/console. You can avoid the control tty problem by having servers which
care about such things cancel their process group explicitly (it's a trivial
change to any variety of UNIX kernel to add a system call to zero out your
process group, if your system doesn't already provide it). Doing it this way,
rather than letting the server depend on an incidental property of /etc/rc's
environment, allows you to conduct complete tests of such servers from
your terminal, besides being more robust. Note that the normal ARPANET
servers, including server telnet, don't care about the process group
situation anyway.

It should also be pointed out that the default situation (opening "/") is not
completely bug free, at least in V6. Before we changed our init, we had a
problem with our server FTP (started from /etc/rc); if someone used its XSEN or
XSEM commands to write to a logged-in user's terminal, the poor user would
subsequently find that interrupts and quits no longer worked! Server FTP had no
process group, so when it opened up the terminal a new one was generated and
assigned to the terminal . V7 fixes this; once a terminal gets a pgroup, it
must be closed before its process group can be changed. (This fix introduced
another problem; in V6, if you started a process in the background without nohup
and wanted it to continue running after you hung up, all you had to do was type
ctrl-D and get a new herald before hanging up. Under V7 this won't work, since
the background process keeps the terminal open and prevents the process group
from changing. The Berkeley C shell ignores hangups on background processes;
we've changed the Bourne shell to do the same.)



More information about the Comp.unix.wizards mailing list