4.3 BSD and getting rid of control tty
Ian Donaldson
rcodi at chudich.co.rmit.oz
Sat Sep 9 11:46:12 AEST 1989
abe at mace.cc.purdue.edu (Vic Abell) writes:
>In article <15412 at dartvax.Dartmouth.EDU>, ericb at libdev.dartmouth.edu (Eric Bivona) writes:
> about disassociating from a /dev/tty whose control terminal is
> no longer open.
>I reported this problem to Berkeley some time ago - ca. October, 1988.
>My solution is to use a SIGALRM around the open of /dev/tty. It avoids
>a kernel hack.
An almost equivalent operation is:
setpgrp(0, 0);
It has the effect that no signals will be sent to your process anymore from
terminals, even though your process is still logically associated with
a tty (as far as /bin/ps shows), and it also has the effect that
the next tty you open becomes your controlling tty.
TIOCNOTTY only has one advantage over this: it removes the association
with the original tty. This is rarely noticed. It also has the
disadvantage that you noted... blocking if the tty is no longer open
by any process (and it waits for carrier).
Ian D
More information about the Comp.unix.wizards
mailing list