process group of tty**

Larry Allen lwa at osf.org
Tue Mar 27 06:14:34 AEST 1990


GNU Emacs does this, on 4.xBSD systems, by using ioctl(TIOCGPGRP)
on the master side of the pty.  This counts on the TIOCGPGRP on
the master side actually returning the process group associated
with the slave side of the pty.  This always struck me as being
suspect, but there's no other way to do it that I know of.  Ideally,
perhaps, there would be a set of ioctl's that were specific to pty's
that allowed the controlling process to inquire and change slave
side attributes via the master pty, but (aside from REMOTE and
PACKET modes) there aren't any such ioctl's today.

I had occasion to look into this code because it broke as a result
of the 4.4BSD changes to support Posix semantics; the 4.4bsd 
implementation supports TIOCGPRGP as a layer on the Posix tcgetpgrp()
call (or the other way around -- I forget which), and Posix mandates
that tcgetpgrp() must only work on the process' controlling TTY.
Emacs, of course, didn't check for this error, and as a result
was silently unable to signal subjobs.
						-Larry Allen
						 Open Software Foundation



More information about the Comp.unix.wizards mailing list