From owner-freebsd-current@FreeBSD.ORG Wed Jun 25 22:44:46 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3780137B401; Wed, 25 Jun 2003 22:44:46 -0700 (PDT) Received: from puffin.mail.pas.earthlink.net (puffin.mail.pas.earthlink.net [207.217.120.139]) by mx1.FreeBSD.org (Postfix) with ESMTP id 52C9544030; Wed, 25 Jun 2003 22:44:45 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfirs.dialup.mindspring.com ([165.247.203.124] helo=mindspring.com) by puffin.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19VPYj-0000NV-00; Wed, 25 Jun 2003 22:44:37 -0700 Message-ID: <3EFA8803.8D8B947B@mindspring.com> Date: Wed, 25 Jun 2003 22:43:31 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: John-Mark Gurney References: <20030624183515.A42570@FreeBSD.org> <1056499632.662.7.camel@timon.nist> <3EF922BE.4070803@acm.org> <20030625001525.A60867@FreeBSD.org> <20030625074151.GY57612@funkthat.com> <3EF9D31F.6010401@acm.org> <20030625172810.GB57612@funkthat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4f37d47cd87416ed13c08bb99b55a618d350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: Juli Mallett cc: Andrey Chernov cc: freebsd-current@freebsd.org cc: "Tim J. Robbins" cc: Tim Kientzle Subject: Re: tcsh being dodgy, or pipe code ishoos? X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jun 2003 05:44:46 -0000 John-Mark Gurney wrote: > Tim Kientzle wrote this message on Wed, Jun 25, 2003 at 09:51 -0700: > > Why do exec-ed processes inherit the children of the former > > process, anyway? That doesn't entirely sound right to me. > > Is that behavior mandated by some standard? If not, this > > could arguably be considered a kernel bug. Hmmm... > > Could someone look into this for me? I don't have any of the standards > document. Hmmm. does APUE even talk about this? It's more of a question > if exec'd processes inherit children. The original "Go Solo 2" book says: Parent process ID An attribute of a new process identifying the parent of the process. The parent process ID of a process is the process ID of its creator, for the lifetime of the creator. After the creator's lifetime has ended, the parent process ID is the process ID of an implementation- dependent system process. Pretty clear to me they mean "init". Now the question is whether or not the creator's lifetime has ended; looking at: http://www.opengroup.org/onlinepubs/007904975/functions/exec.html the answer is not clear; specifically: The new process shall inherit at least the following attributes from the calling process image: [...] Process ID [...] Session membership [...] Time left until an alarm clock signal (see alarm() ) [...] Interval timers [...] So it seems to me that the answer is a qualified "yes"; the SIGALRM signals pending expiration of the alarm/itimer interval argue very strongly that the other pending signals (e.g. SIGCHLD) may also be inherited. Probably it's wrong for the program to fork for itself and exec its child, instead of fork+exec for the child, and remaining itself. -- Terry