Date: Thu, 26 Aug 1999 23:44:45 +0200 From: Bjoern Fischer <bfischer@Techfak.Uni-Bielefeld.DE> To: Andrew Gallatin <gallatin@cs.duke.edu> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: undocumented vfork behaviour? Message-ID: <19990826234445.A320@frolic.no-support.loc> In-Reply-To: <14277.18939.326895.354112@grasshopper.cs.duke.edu> References: <14277.18939.326895.354112@grasshopper.cs.duke.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990826234445.A320>