Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!njin!princeton!phoenix!bernsten From: bernsten@phoenix.Princeton.EDU (Dan Bernstein) Newsgroups: comp.unix.questions Subject: Re: Avoiding processes on Ultrix Message-ID: <7693@phoenix.Princeton.EDU> Date: 11 Apr 89 22:01:46 GMT References: <520@pan.UUCP> Reply-To: bernsten@phoenix.Princeton.EDU (Dan Bernstein) Distribution: usa Organization: Hmph. Lines: 20 In article <520@pan.UUCP> jw@pan.UUCP (Jamie Watson) writes: > Is there any way under Ultrix (2.0 or later) to write a C program > such that any child processes created by that program will exit, > without hanging in an status until the parent does a wait() > for the child? Under SysV this is done with signal(SIGCLD, SIG_IGN); > I have tried that under Ultrix, to no avail. I'm surprised nobody's mentioned setting up a SIGCLD/SIGCHLD handler that does a wait(). sigchld() { wait(0); } signal(SIGCHLD,sigchld); This is faster (on some machines, much much faster) than an extra fork(). It is certainly more general than ignoring the signal, and it's the basis for the shell job control (with a more intelligent sigchld()). ---Dan Bernstein, bernsten@phoenix.princeton.edu