controlling ttys and process groups (was transferring processes under csh)
der Mouse
mouse at mcgill-vision.UUCP
Sun Sep 11 20:04:27 AEST 1988
In article <235 at longway.TIC.COM>, jsq at longway.TIC.COM (John S. Quarterman) writes:
> In article <2364 at pixar.UUCP> rta at pixar.UUCP (Rick Ace) writes:
>> 3. Processes have direct handles (file descriptors) on terminals;
>> they do not go indirect a job-common location.
> The controlling terminal is associated with a process group, and
> sends keyboard-generated signals like SIGHUP, SIGINT, and SIGQUIT to
> processes in that process group.
But -- surprise! -- under BSD at least, the controlling tty is not
necessarily related to process group similarities. When someone types
the interrupt character for a tty, a SIGINT signal is sent to all
processes with a process group matching the process group of the tty.
This is usually a subset of the set of processes whose controlling tty
is the tty in question, but need not be related at all.
> The controlling terminal is the one you get when you open /dev/tty.
Close. When you open /dev/tty (BSD again), you get connected to a
special device driver. I/O to this driver gets handed off to the
driver of the controlling tty. What's the difference? Wellll....
- If you fstat() a file descriptor obtained by opening /dev/tty, you
get the major and minor device numbers for /dev/tty rather than those
for the controlling tty.
- If you change controlling ttys, I/O to /dev/tty suddenly switches to
the new controlling tty. (If you detach from the control tty and
don't attach to some other tty, I/O to /dev/tty fails with ENXIO.)
I'd like to see a device (/dev/ctltty maybe?) which, when opened,
actually gave you a file descriptor as if you had opened the real
control tty, thus providing the ability to avoid the above two points,
if they cause problems for your application.
(Of course, what we *really* need is a better notion of terminal lines.
But I don't see that coming anytime soon - I certainly haven't anything
"better" to suggest.)
der Mouse
old: mcgill-vision!mouse
new: mouse at larry.mcrcim.mcgill.edu
More information about the Comp.unix.wizards
mailing list