home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / question / 10391 < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.7 KB  |  57 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!usc!aero.org!desktalk.desktalk.com!styx.desktalk.com!dss
  3. From: dss@styx.desktalk.com (David S. Spencer)
  4. Subject: subprocess doesn't receive SIGCHLD...process groups?
  5. Message-ID: <1992Aug25.173226.26878@desktalk.desktalk.com>
  6. Sender: usenet@desktalk.desktalk.com
  7. Nntp-Posting-Host: styx
  8. Organization: DeskTalk Systems Inc.
  9. Distribution: na
  10. Date: Tue, 25 Aug 1992 17:32:26 GMT
  11. Lines: 44
  12.  
  13. Quick summary: proc A starts B who starts C but B doesn't receive SIGCHLD when
  14. C dies.
  15.  
  16. Explanation:
  17.  
  18. I have three programs:  "server", "worker", and "parent".
  19.  
  20. "server" listens for a TCP connection, starts "worker" when it receives the 
  21. connection, waits for a SIGCHLD, and cleans up when "worker" finishes.
  22. Everything here works fine.
  23.  
  24. "parent" is supposed to start child processes and restart them when they die.
  25. If I have it run w/ "server", it starts up "server" just fine, who then
  26. starts up "worker" when it is supposed to.  The problem is that "server" 
  27. doesn't receive SIGCHLD anymore when "worker" dies - for that matter, neither
  28. does "worker".  
  29.  
  30. Question: Why doesn't "server" receive SIGCHLD?
  31.  
  32. I suspected that it had to do w/ process groups, so I inserted what
  33. I thoght was the correct code into "parent":
  34.  
  35.     if ( fork() == 0) {    /* Child half of fork. */
  36.     if ( setpgrp( getpid(), getpid()) < 0) {
  37.         perror( "setpgrp");
  38.         _exit( 101);
  39.     }
  40.     /* Now exec "server" */
  41.     }
  42.     else {    /* Parent half. */
  43.     }
  44.  
  45. But this doesn't change anything.  Any ideas?
  46.  
  47. Note: I'm running SunOS 4.1.2.
  48.  
  49.         Thanks,
  50.             - Dave
  51.  
  52. -- 
  53. ----------------------------------------------------------------------
  54. David Spencer        Desktalk Systems Inc.
  55. dss@destalk.com
  56. ----------------------------------------------------------------------
  57.