[net.unix-wizards] reassigning a control terminal

mms@bocklin.UUCP (10/08/85)

Is there any way to reassign the control terminal associated with a
process that has been forked from a process to which a control ter-
minal is associated?  That is, can I get a forked process to change
the device associated with /dev/tty?  We are running 4.2bsd.

I could be overlooking something very simple, but then again, I've
not been successful.  If it is possible, could someone outline the
necessary proceedure?  (Mail it to me directly if I'm being overly
ignorant).

My underlying motivation is to turn off logins in /etc/ttys for some
device, and have another process that emulates init do "execl getty"
on that device.  However, getty seems to operate on the control ter-
minal it is associated with.

--
Mark M. Swenson                          Department of Computer Science
mms%arizona@csnet-relay                       The University of Arizona
{ihnp4,noao,mcnc,utah-cs}!arizona!mms     Tucson, Arizona  85721 // USA

guy@sun.uucp (Guy Harris) (10/13/85)

> Is there any way to reassign the control terminal associated with a
> process that has been forked from a process to which a control ter-
> minal is associated?  That is, can I get a forked process to change
> the device associated with /dev/tty?  We are running 4.2bsd.

There is an (undocumented, mumble bitch grumble) "ioctl" call that permits a
process which has a control terminal to detach itself from that control
terminal.  You open "/dev/tty" (if it fails, there's no control terminal to
detach yourself from) and do a TIOCNOTTY "ioctl" call (it takes no
parameters).  The next terminal that process opens will become its control
terminal.

	Guy Harris