Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!texbell!nuchat!buster!rli From: rli@buster.irby.com (Buster Irby) Newsgroups: comp.unix.questions Subject: Re: How do you handle while(1) fork(); ? Message-ID: <1990Jul12.211218.20397@buster.irby.com> Date: 12 Jul 90 21:12:18 GMT References: <841@massey.ac.nz> <1990Jul11.115612.2155@aucs.uucp> <4261@uqcspe.cs.uq.oz.au> Reply-To: rli@buster.irby.com Organization: Buster irby Lines: 38 rhys@batserver.cs.uq.oz.au (Rhys Weatherley) writes: >peter@aucs.uucp (Peter Steele) writes: >>ARaman@massey.ac.nz (A.V. Raman) writes: >>>Is there any way to kill all instances of a process that has the >>>following piece of code in it without having to bring the system down? >>> while (1) >>> fork(); >>>Any help (by email) would be appreciated. >>I think a summary of responses to this question would be appreciated. >>We've had students do this on many occasions on our Sun. >I would also be interested in a summary, but how about this one: > while (!fork ()) > { > /* some non-important code */ > } > /* some "clean-up" code */ > exit (0); I don't know about Sun's, but on System V you can use the fuser command to kill all processes attacked to the tty or any other common resource which is shared by all of the children. It can be used to effectively perform a kill process group operation on all processes attatched to a specific tty as follows: $ fuser -k /dev/tty?? P.S. You must be root to execute this as it sends the SIGKILL signal to the processes. -- Buster Irby buster!rli