home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10438 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  1.1 KB

  1. Xref: sparky comp.unix.questions:10438 comp.unix.shell:3661
  2. Newsgroups: comp.unix.questions,comp.unix.shell
  3. Path: sparky!uunet!usc!cs.utexas.edu!hermes.chpc.utexas.edu!news.utdallas.edu!corpgate!crchh327!crchh451!herrage
  4. From: herrage@crchh451.bnr.ca (Robert Herrage)
  5. Subject: Killing Offspring
  6. Message-ID: <1992Aug27.160525.21166@bnr.ca>
  7. Sender: news@bnr.ca (News on crchh327)
  8. Nntp-Posting-Host: crchh451
  9. Reply-To: herrage@bnr.ca
  10. Organization: BNR
  11. Date: Thu, 27 Aug 1992 16:05:25 GMT
  12. Lines: 15
  13.  
  14. I have a parent process that forks a child process (C1).  C1, in turn, forks
  15. a grandchild process (GC1) which calls "system()" to execute a shell-script.
  16.  
  17. While the shell-script is running, the parent process can fork another child
  18. process (C2) whose job is to abort whatever GC1 is doing.  All processes have
  19. access to each others PIDs via shared memory.
  20.  
  21. When C2 uses kill() to terminate GC1, GC1 becomes <defunc> and the shell-
  22. script keeps on executing.
  23.  
  24. Is there a way that I can terminate the shell-script too without C2 having 
  25. to call "system()" with some fancy "ps" command to obtain the PID of the 
  26. shell-script?
  27.  
  28. Any help would be appreciated.
  29.