From owner-freebsd-current Tue Dec 18 16:24:29 2001 Delivered-To: freebsd-current@freebsd.org Received: from elvis.mu.org (elvis.mu.org [216.33.66.196]) by hub.freebsd.org (Postfix) with ESMTP id 0250937B419 for ; Tue, 18 Dec 2001 16:24:27 -0800 (PST) Received: by elvis.mu.org (Postfix, from userid 1192) id 811C481E0C; Tue, 18 Dec 2001 18:24:21 -0600 (CST) Date: Tue, 18 Dec 2001 18:24:21 -0600 From: Alfred Perlstein To: Julian Elischer Cc: current@freebsd.org Subject: Re: Is this a bug in the fork() code? Message-ID: <20011218182421.M59831@elvis.mu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from julian@elischer.org on Tue, Dec 18, 2001 at 04:01:44PM -0800 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG * Julian Elischer [011218 18:20] wrote: > > now, what is to say that the process has not exitted by this stage, and > been reeped by init (on SMP) > particularly since between the two is: > > /* > * Preserve synchronization semantics of vfork. If waiting for > * child to exec or exit, set P_PPWAIT on child, and sleep on our > * proc (in case of exit). > */ > PROC_LOCK(p2); > while (p2->p_flag & P_PPWAIT) > msleep(p1, &p2->p_mtx, PWAIT, "ppwait", 0); > PROC_UNLOCK(p2); > > It may be that due to some semantics of teh fork calls > you cannot have P_PPWAIT and a process queued to run on the other > processor while reparented to init(1) but I can't see it.. > the result would be that the return value MIGHT be teh pid > of a totally different process if the proc structure had been re-used. > > Alternatively I could have some good weed here... That's not possible, since the parent is waiting the kernel will not reparent unless the parent exits, which it doesn't because it's waiting for the child. You owe the Oracle a large bong rip. -- -Alfred Perlstein [alfred@freebsd.org] 'Instead of asking why a piece of software is using "1970s technology," start asking why software is ignoring 30 years of accumulated wisdom.' http://www.morons.org/rants/gpl-harmful.php3 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message