🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1214

How to guarantee the death of a child process

#1214
From: Todd Chauvin
Date: Wed, 14 Nov 1990 18:05
30 lines
1667 bytes
Hello,

I am working with a large simulation of a complicated communications network.
The program is implemented as three separate processes.  

On startup:  	1) parent creates three pipes
		2) for each of the two child processes, parent does a 
		   vfork/exec, assigning input/output streams to
		   the pipes created in (1)

This simulation program is only useful if all three processes are running.

The problem:

	How can I arrange the processes such that if any one of them dies
	for *any* reason, the remaining two will be killed.

I've experimented with catching SIGCHLD in the parent process but with only
limited success.  The problems that I can't figure out how to solve with
SIGCHLD are (1) figuring out which child generated the SIGCHLD  (2) stopping
SIGCHLD from being delivered to the parent when the parent process is
stopped from the keyboard and put into background, and (3) SIGCHLD only 
detects the death of a child.  If I kill the parent, how do the child 
processes know to die?  

Anyone have any ideas how this should be done? Any thoughts/advice appreciated!

Todd Chauvin
chauvin@galway.jpl.nasa.gov
Technical Details
Message-ID: <1990Nov14.180538.9896@elroy.jpl.nasa.gov>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!usc!elroy.jpl.nasa.gov!galway!chauvin

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!usc!elroy.jpl.nasa.gov!galway!chauvin
From: chauvin@galway.jpl.nasa.gov (Todd Chauvin)
Newsgroups: comp.unix.programmer
Subject: How to guarantee the death of a child process
Message-ID: <1990Nov14.180538.9896@elroy.jpl.nasa.gov>
Date: 14 Nov 90 18:05:38 GMT
Sender: news@elroy.jpl.nasa.gov (Usenet)
Distribution: usa
Organization: Jet Propulsion Laboratory
Lines: 30
Originator: chauvin@galway
Nntp-Posting-Host: galway.jpl.nasa.gov