[comp.std.unix] controlling terminals in POSIX

gerry@SSD.CSD.HARRIS.COM (Gerry Baumgartner) (01/06/90)

From: gerry@SSD.CSD.HARRIS.COM (Gerry Baumgartner)

I have a few questions on controlling terminals in POSIX.   I don't know 
whether the supplements address these questions.

1) 7.1.1.3  "The Controlling Terminal" says that a process relinquishes its
controlling terminal when it creates a new session with setsid(), or when all
file descriptors associated with the controlling terminal have been closed.
Also, if a process which is not a session leader opens a terminal file, that
terminal shall not become the controlling terminal of the calling process.

Currently in the System V implemention, after a process has closed all it's
file descriptors to the controlling terminal, he CAN open /dev/tty and be
"reconnected" to it, and thus have a controlling terminal again.  But /dev/tty 
is a terminal file isn't it?  Does that mean that it should not be allowed to
be opened after a process has "relinquished" it?   I understand that if the
controlling terminal was say, /dev/tty15, and a non-session-leader relinquished
it and the tried to open /dev/tty23, the new tty should not become the
controlling terminal for the process.   But /dev/tty seems to be a special
case that the standard doesn't address.

And it seems to me the only time that "relinquishing" a controlling terminal 
has any real consequences is when the session leader does it.  At that point, 
in the words of the standard, processes of the session MAY be denied access to
what once was their controlling	terminal. 

2) 7.1.1.9  "Special Characters", for INTR and QUIT says that the signal is
sent to all processes in the foreground process group for which the terminal is
the controlling terminal.

This to me is somewhat ambiguous.  Do all the processes in the foreground
process group get the signal or just those processes that have not relinquished
their controlling terminal by closing all their file descriptors to it?


Any comments regarding these questions would be appreciated.
-------------------------------------------------------------------------------
Gerry Baumgartner                |    gerry@ssd.csd.harris.com 
System Software Development      | or gerry%ssd.csd.harris.com@eddie.mit.edu
Harris Computer Systems Division | or ...!{mit-eddie,uunet,novavax}!hcx1!gerry
Fort Lauderdale FL 33309         |
-------------------------------------------------------------------------------

Volume-Number: Volume 18, Number 7