news@zardoz.cpd.com (usenet news administrator) (03/27/90)
I have a program that needs to be able to send a HUP signal to the process group associated with the tty side of a tty/pty pair. The program has the pty side opened as a file, and knows the ascii file name of the tty side. If it could find out the process group, it could use killpg(). Alternately, if it could find out the process id of the controlling process (the one that originally opened the tty side as a file, it could send the signal using kill(). HELP !!!!! -- Neil Gorsuch INTERNET: neil@cpd.com UUCP: uunet!zardoz!neil MAIL: 1209 E. Warner, Santa Ana, CA, USA, 92705 PHONE: +1 714 546 1100 Uninet, a division of Custom Product Design, Inc. FAX: +1 714 546 3726 AKA: root, security-request, uuasc-request, postmaster, usenet, news
lwa@osf.org (Larry Allen) (03/27/90)
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
guy@auspex.auspex.com (Guy Harris) (03/28/90)
>I have a program that needs to be able to send a HUP signal to the >process group associated with the tty side of a tty/pty pair. The driver for your serial board, right? In: 1) SunOS 4.x; 2) SunOS 3.x and later, for some value of "x" >= 2; and 3) probably System V Release 4 there's an "ioctl" you can do on the master side that causes a signal to be delivered to the process group of the slave side, namely TIOCSIGNAL. Its argument is a pointer to an "int" containing the signal value. If you don't have that, try doing TIOCGPGRP to find out what process group to which to send the signal.