From owner-freebsd-hackers Thu Aug 26 17:45:42 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.uni-bielefeld.de (mail.uni-bielefeld.de [129.70.4.90]) by hub.freebsd.org (Postfix) with ESMTP id 262751544B for ; Thu, 26 Aug 1999 17:45:38 -0700 (PDT) (envelope-from bfischer@Techfak.uni-bielefeld.de) Received: from frolic.no-support.loc (ppp36-56.hrz.uni-bielefeld.de) by mail.uni-bielefeld.de (Sun Internet Mail Server sims.3.5.1999.03.02.17.58.p5) with ESMTP id <0FH300NHWM3W4D@mail.uni-bielefeld.de> for freebsd-hackers@FreeBSD.ORG; Fri, 27 Aug 1999 02:45:37 +0200 (MET DST) Received: (from bjoern@localhost) by frolic.no-support.loc (8.9.3/8.9.3) id XAA75763; Thu, 26 Aug 1999 23:44:45 +0200 (CEST envelope-from bjoern) Date: Thu, 26 Aug 1999 23:44:45 +0200 From: Bjoern Fischer Subject: Re: undocumented vfork behaviour? In-reply-to: <14277.18939.326895.354112@grasshopper.cs.duke.edu> To: Andrew Gallatin Cc: freebsd-hackers@FreeBSD.ORG Message-id: <19990826234445.A320@frolic.no-support.loc> MIME-version: 1.0 X-Mailer: Mutt 0.95.7i Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable References: <14277.18939.326895.354112@grasshopper.cs.duke.edu> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Thu, Aug 26, 1999 at 10:40:29AM -0400, Andrew Gallatin wrote: [...] > Specifically, when a linux/alpha process forks, the child's return > value is the parent's pid rather than zero. [...] > If I run the following code on FreeBSD/i386, I see: > parent's pid =3D 6730 > I am the child, result =3D 0 > I must be the parent, result =3D 6731 >=20 > Whereas FreeBSD/alpha does this: >=20 > parent's pid =3D 17721 > I must be the parent, result =3D 17721 > I must be the parent, result =3D 17722 The Single Unix Specification says about this: RETURN VALUE Upon successful completion, vfork() returns 0 to the child process and returns the process ID of the child process to the parent process. Otherwise, -1 is returned to the parent, no child process is created, and errno is set to indicate the error. Returning the PPID for the child would break many sources, as you already said. Bj=F6rn --=20 -----BEGIN GEEK CODE BLOCK----- GCS d--(+) s++: a- C+++(-) UB++++OSI++++$ P+++(-) L+++(--) !E W- N+ o>+ K- !w !O !M !V PS++ PE- PGP++ t+++ !5 X++ tv- b+++ D++ G e+ h-- y+=20 ------END GEEK CODE BLOCK------ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message