From owner-freebsd-questions Mon Jan 17 8:45:20 2000 Delivered-To: freebsd-questions@freebsd.org Received: from bomber.avantgo.com (ws1.avantgo.com [207.214.200.194]) by hub.freebsd.org (Postfix) with ESMTP id 4BE9114BC9 for ; Mon, 17 Jan 2000 08:45:07 -0800 (PST) (envelope-from scott@avantgo.com) Received: from river ([10.0.128.30]) by bomber.avantgo.com (Netscape Messaging Server 3.5) with SMTP id 328 for ; Mon, 17 Jan 2000 08:41:12 -0800 Message-ID: <02f701bf610a$0c5fdec0$1e80000a@avantgo.com> From: "Scott Hess" To: Subject: Detecting when your parent process dies. Date: Mon, 17 Jan 2000 08:43:57 -0800 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2314.1300 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Is there any way for an rfork() process to detect if it's parent process has died? I mean via some sort of asynchronous notification? I can detect death of a child process via SIGCHLD and wait()/wait4(). I can detect death of a fork()ed parent by opening a pipe before the fork, and having the child detect when the pipe gets closed. Unfortunately, I'm using rfork() such that file descriptors are shared, so the OS won't close the parent's file descriptors on premature termination. The best idea I've come up with thus far is to spin a manager process which creates the current parent process as a child, and then let that process watch for SIGCHLD. This seems a bit extreme (not to mention confusing, because it means that the "real" pid of the process isn't the first one of ten, it's the second one of ten...). Ideas? Thanks, scott To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message