Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!spool.mu.edu!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: POSIX bashing Message-ID: <6990@auspex.auspex.com> Date: 3 Apr 91 19:01:13 GMT Article-I.D.: auspex.6990 References: <1991Mar30.012025.28876@kithrup.COM> <25262@hydra.gatech.EDU> <1991Mar30.202637.8629@kithrup.COM> Organization: Auspex Systems, Santa Clara Lines: 30 >The pty driver does not allow the master side to do an TIOCGPGRP on the >slave side (as they are running in different process groups, and POSIX says >that this should not happen for normal ttys). I found this in emacs, >incidently. I made a kernel change to allow a new ioctl (TIOCSIG), which >sends a specified signal to the process group on the slave side of the pty. >However, it is rife with security holes, so I only used it myself. The >folks at Berkeley did the same thing when I reported the "problem" to them, >which was where I got the idea. rms claims, and there is some indication to >back him up on this, that pty's are an extension, thus the TIOCGPGRP ioctl >should be allowed to work. Oh, I certainly agree. TIOCGPGRP on the master side of a pty should report what process group the pty master is in, that process group being the one to which a SIGIO is sent whenever I/O is possible on the master side. TIOCSPGRP on the master side should set that process group. That process group is, of course, completely independent of the process group the *slave* is in. TIOCSIG, or something like it, is the right answer if the process on the master side has to send a signal to the slave side. If one is worried about security, one can restrict it to sending SIGINT, SIGQUIT, and SIGTSTP. >(Note, btw, that my ioctl is better: if you are running an SUID process >in the window, emacs cannot send any signal to it; with my change and >kernel enhancement, it can. Absolutely! Sending tty signals to the slave side of a pty by doing a TIOCGPGRP and a "kill()" is the wrong answer.