From owner-freebsd-current Tue Jul 3 22:54:52 2001 Delivered-To: freebsd-current@freebsd.org Received: from mailgate.novagate.net (mailgate.novagate.net [205.138.138.22]) by hub.freebsd.org (Postfix) with ESMTP id 4AD2B37B403; Tue, 3 Jul 2001 22:54:49 -0700 (PDT) (envelope-from djhill@novagate.net) Received: from rain.hill.hom (081bc122.chartermi.net [24.247.81.122]) by mailgate.novagate.net (8.11.3/8.11.3) with SMTP id f645smq57373; Wed, 4 Jul 2001 01:54:48 -0400 (EDT) (envelope-from djhill@novagate.net) Date: Wed, 4 Jul 2001 01:54:18 -0400 From: David Hill To: Gregory Neil Shapiro Cc: freebsd-current@FreeBSD.ORG Subject: Re: system and (v)fork Message-Id: <20010704015418.769fa3eb.djhill@novagate.net> In-Reply-To: <15170.44698.988817.714880@horsey.gshapiro.net> References: <20010704014703.4ec62b5f.djhill@novagate.net> <15170.44698.988817.714880@horsey.gshapiro.net> X-Mailer: Sylpheed version 0.5.0pre2 (GTK+ 1.2.10; i386-unknown-freebsd4.3) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 On Tue, 3 Jul 2001 22:50:18 -0700 Gregory Neil Shapiro wrote: > djhill> Reading Advanced Programming in the UNIX Environment by Richard > djhill> W. Stevens, I see that he says that vfork() should be used instead > djhill> of fork() when you just need to use one of the exec() functions, > djhill> since it doesn't need to fully copy the address space. > > djhill> Later in the book, he has an example system() which uses fork() to > djhill> run /bin/sh -c via the execl() function. > > djhill> Why wouldn't he use vfork() instead of fork()? > > If there is anything that modifies memory or file descripts between the > fork() and exec*() call, you can't use vfork(). > Ahh, understood. Thanks for the quick response - David To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message