Subject: allocating controlling terminal on tty open?
To: None <current-users@NetBSD.ORG>
From: Todd Vierling <>
List: current-users
Date: 11/05/1997 20:31:32
Now that we have pty's under SVR4, I can run dtterm and xterm from Solaris. 
Nice, but the tcsh shell says it can't do TIOCGPGRP because its tty isn't
actually a controlling tty.  <grumble>  termios(7) reads:

    A controlling terminal is never acquired by merely opening a terminal
    device file.

Hm, has it always been this way?  I can't recall.  It seems that SVR4
assumes that you allocate a controlling terminal by doing setpgrp() (SVR4
doesn't take arguments; the emulation makes it equivalent to setpgid(0,0))
in the child process followed by an open of a tty.  setsid() isn't called,
except by the parent process (which is already a process group leader, so it
gets EPERM).

Suggestions on how to get the child process to allocate a controlling tty? 
Is there any way to make a tty become controlling terminal when opened (or
opened for the first time) by a process group leader created by setpgrp()? 
I can't do it through emulation when TIOCGPGRP is called, because by that
time, the emulation is back to 'netbsd' (a native shell). 

== Todd Vierling (Personal; Business
== So you know what, Mikey?  Go to bed.