home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.questions
- Path: sparky!uunet!usc!aero.org!desktalk.desktalk.com!styx.desktalk.com!dss
- From: dss@styx.desktalk.com (David S. Spencer)
- Subject: subprocess doesn't receive SIGCHLD...process groups?
- Message-ID: <1992Aug25.173226.26878@desktalk.desktalk.com>
- Sender: usenet@desktalk.desktalk.com
- Nntp-Posting-Host: styx
- Organization: DeskTalk Systems Inc.
- Distribution: na
- Date: Tue, 25 Aug 1992 17:32:26 GMT
- Lines: 44
-
- Quick summary: proc A starts B who starts C but B doesn't receive SIGCHLD when
- C dies.
-
- Explanation:
-
- I have three programs: "server", "worker", and "parent".
-
- "server" listens for a TCP connection, starts "worker" when it receives the
- connection, waits for a SIGCHLD, and cleans up when "worker" finishes.
- Everything here works fine.
-
- "parent" is supposed to start child processes and restart them when they die.
- If I have it run w/ "server", it starts up "server" just fine, who then
- starts up "worker" when it is supposed to. The problem is that "server"
- doesn't receive SIGCHLD anymore when "worker" dies - for that matter, neither
- does "worker".
-
- Question: Why doesn't "server" receive SIGCHLD?
-
- I suspected that it had to do w/ process groups, so I inserted what
- I thoght was the correct code into "parent":
-
- if ( fork() == 0) { /* Child half of fork. */
- if ( setpgrp( getpid(), getpid()) < 0) {
- perror( "setpgrp");
- _exit( 101);
- }
- /* Now exec "server" */
- }
- else { /* Parent half. */
- }
-
- But this doesn't change anything. Any ideas?
-
- Note: I'm running SunOS 4.1.2.
-
- Thanks,
- - Dave
-
- --
- ----------------------------------------------------------------------
- David Spencer Desktalk Systems Inc.
- dss@destalk.com
- ----------------------------------------------------------------------
-