home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!ames!sun-barr!rutgers!njitgw.njit.edu!hertz.njit.edu!jxv3790
- From: jxv3790@hertz.njit.edu (Jake Vogelaar)
- Newsgroups: comp.unix.programmer
- Subject: Need help with signal handling !
- Keywords: SIGCLD & wait()
- Message-ID: <1992Nov10.052631.26541@njitgw.njit.edu>
- Date: 10 Nov 92 05:26:31 GMT
- Sender: news@njit.edu
- Organization: New Jersey Institute of Technology, Newark, N.J.
- Lines: 24
- Nntp-Posting-Host: hertz.njit.edu
-
- I'm writing a simple shell that needs to output info on the event of the
- death of any of its children. I have been trying to implement this by
- writing a function that caught SIGCLD did a wait3 and than a wait for
- the death of the child. Since this is system V (or Ultrix) I reset the
- signal handler in the function every time.
-
- In the main program I have a loop like this:
- if ((frk=fork())==0)
- /* child execlp */
- else if frk==-1 error();
- else if (!ampersand) wait(&status);
- no problems with this if the command line has no '&', but if it does than
- both the child and the parent shell exit. (gdb reports a SEGV error)
-
- Anybody know what I'm doing wrong, or how to implement this in a better way?
-
- Thanks,
-
- -jake
- --
- /////////////////////////////////////////////////////////////////////////
- Jake Vogelaar, jxv3790@hertz.njit.edu
- Computer Vision R&D, Warner-Lambert Manufacturing Development Laboratory
- New Jersey Institute of Technology
-