From owner-freebsd-hackers Tue Jul 9 12:22:27 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA29533 for hackers-outgoing; Tue, 9 Jul 1996 12:22:27 -0700 (PDT) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA29528; Tue, 9 Jul 1996 12:22:26 -0700 (PDT) Received: from tombstone.sunrem.com (tombstone.sunrem.com [206.81.134.54]) by who.cdrom.com (8.6.12/8.6.11) with ESMTP id MAA06828 ; Tue, 9 Jul 1996 12:22:25 -0700 Received: (from brandon@localhost) by tombstone.sunrem.com (8.6.12/8.6.12) id NAA04923; Tue, 9 Jul 1996 13:21:06 -0600 Date: Tue, 9 Jul 1996 13:21:06 -0600 (MDT) From: Brandon Gillespie To: Gary Palmer cc: freebsd-hackers@FreeBSD.ORG Subject: Re: handling SIGCHLD with multiple children In-Reply-To: <28527.836939654@palmer.demon.co.uk> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Tue, 9 Jul 1996, Gary Palmer wrote: > Brandon Gillespie wrote in message ID > : > > Is there _ANY_ way of finding what child sent a SIGCHLD signal to the > > parent process? I have a situation where a parent may have multiple > > children processing different tasks, and the parent is waiting for one > > child to complete a specific task, which it cares about, but it does not > > care about the other children. Because of this in most instances when > > SIGCHLD is received it simply resets it and continues working, except for > > now I need to handle things differently when a specific child sends > > SIGCHLD. Is there any ANY way to figure out where it came from? > > Do you really need to sit on SIGCHLD or can you use waitpid()? Or you > could perhaps even use waitpid() in the SIGCHLD handler, with WNOHANG > option, to see which child exited... The server is a object oriented database driver (with its own interpreted language), and the child is handling a backup pseudo-asyncrynously. Basically it syncronizes its database on disk, sets it read-only and forks a child which begins the actual backup. When the child is finished copying the server knows to go back to a read/write db when it receives the signal. However, there is also the possibility of other children with different purposes being forked as well. Furthermore, the server is handling network connections, and does NOT want to block while it backups, due to the time involved with a sizeable database. I suppose I could just use one of the SIGUSR* signals.. -Brandon Gillespie