From owner-freebsd-hackers Wed Apr 7 18:48:29 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from nomis.simon-shapiro.org (nomis.simon-shapiro.org [209.86.126.163]) by hub.freebsd.org (Postfix) with SMTP id DA84614C98 for ; Wed, 7 Apr 1999 18:48:23 -0700 (PDT) (envelope-from shimon@simon-shapiro.org) Received: (qmail 44501 invoked by uid 1000); 8 Apr 1999 01:49:59 -0000 Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <199904080047.RAA17480@salsa.gv.tsc.tdk.com> Date: Wed, 07 Apr 1999 21:49:59 -0400 (EDT) X-Face: --Q&x/1^%>&*}<-P_Nc`3TWi's/BcC?8]O1b,;r$#7wzaSo-\/:3NE{Wm=?;i8{R'h.gsd8 %Hz|Y~=sSW"`VLLNW/{>Ap1%:OB*:KP|LD>" =)I@7r|wU}a To: Don Lewis Subject: Re: wait4 - Proof I am stupid Cc: freebsd-hackers@FreeBSD.ORG Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 08-Apr-99 Don Lewis wrote: > On Apr 7, 8:32pm, Simon Shapiro wrote: > } Subject: wait4 - Proof I am stupid > > } /* > } * So far, this code should (and does) fork a process. > } * This process (child then changes its process group to something > else > } * than the parent and then forks 10 children. > } * > } * Now the parent wants to wait for the grandchidren... > } */ > > I don't believe that it is possible to wait for processes other than > immediate children. Then the man pages lie. They (both Linux and FreeBSD) say: ... The wpid parameter specifies the set of child processes for which to wait. If wpid is -1, the call waits for any child process. If wpid is 0, the call waits for any child process in the process group of the caller. If wpid is greater than zero, the call waits for the process with process id wpid. If wpid is less than -1, the call waits for any process whose process group id equals the absolute value of wpid. Nowhere does it say what you say. This is not to say you are wrong! In case you are right, how would you go about accomplishing what I want: I have a set of worker processes, which need to get certain signals. They are being managed by a monitor process which may need to get the same signals but react quite differently. Also, the monitor must wait for all the workers to exit, before doing some other work. I could make the shared memory channel more complex and signal completion that way, but this is uncertain and ugly (if a grandson dies without first telling grandpa ``I'm gone'' how is grandpa to know? Simon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message