Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!mit-eddie!ll-xn!ames!amdcad!amd!intelca!oliveb!pyramid!prls!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Re: question - 4bsd ^Z handling and stopping a pipe Message-ID: <827@mcgill-vision.UUCP> Date: Fri, 26-Jun-87 05:29:33 EDT Article-I.D.: mcgill-v.827 Posted: Fri Jun 26 05:29:33 1987 Date-Received: Sat, 4-Jul-87 23:06:49 EDT References: <13907@teknowledge-vaxc.ARPA> Organization: McGill University, Montreal Lines: 28 Xref: mnetor comp.unix.questions:3018 comp.unix.wizards:3047 In article <13907@teknowledge-vaxc.ARPA>, mkhaw@teknowledge-vaxc.ARPA (Michael Khaw) writes: > I've found that when I display a message in elm and ^Z at the "more" > prompt, I'm hung. [analysis] > Are there any 4bsd gurus who can explain what a SIGTSTP handler needs > to do to prevent this? Currently Elm's SIGTSTP handler just restores > default handling (SIG_DFL) and then does a kill(0, SIGTSTP). Then I would say that elm is broken. It should be doing a kill(getpid(),SIGTSTP) instead of kill(0,SIGTSTP). The latter form sends the signal to the entire process group, all of which have already received it from the user's keystroke and may misinterpret another SIGTSTP. But that's not why I think your elm is hanging. The failure mode I expect is occurring is that more, or the shell you saw running with the -c option, probably takes over the process group of the terminal. Then when you type ^Z, the more and its shell get stopped. The elm, however, never sees the signal, 'cause its process group is different (remember, someone stole the tty). Now nobody is listening to your keystrokes! More and its shell are suspended, elm is waiting for the shell it forked to exit (as opposed to just stop), and your top-level shell is waiting for elm to do something (anything). Killing the more and shell wake the elm back up and everybody recovers. der Mouse (mouse@mcgill-vision.uucp)