From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 14256BC0A for ; Wed, 6 Jun 2007 19:50:14 +0200 (CEST) Received: from mail3.sea5.speakeasy.net (mail3.sea5.speakeasy.net [69.17.117.5]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l56HoBO5026458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 6 Jun 2007 19:50:13 +0200 Received: (qmail 23666 invoked from network); 6 Jun 2007 17:50:10 -0000 Received: from dialup-4.242.87.112.dial1.seattle1.level3.net (HELO [4.242.87.112]) (shawnw@[4.242.87.112]) (envelope-sender ) by mail3.sea5.speakeasy.net (qmail-ldap-1.03) with AES128-SHA encrypted SMTP for ; 6 Jun 2007 17:50:10 -0000 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <20070606092840.GH348@first.in-berlin.de> References: <20070605223047.GB30586@yumegakanau.org> <20070606092840.GH348@first.in-berlin.de> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <87557961-A7FE-4FC7-B42A-A1BDF8992712@speakeasy.org> Content-Transfer-Encoding: 7bit From: "Shawn W." Subject: Re: [Caml-list] re: We should all be forking Date: Wed, 6 Jun 2007 10:51:44 -0700 To: caml-list@yquem.inria.fr X-Mailer: Apple Mail (2.752.2) X-Miltered: at concorde with ID 4666F3D3.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; shawnw:01 bandel:01 execv:01 execve:01 shawnw:01 2007,:98 wrote:01 oliver:01 caml-list:01 functions:01 speakeasy:01 speakeasy:01 structures:02 variables:02 exit:04 On Jun 6, 2007, at 2:28 AM, Oliver Bandel wrote: > > vfork is only (!!!) for a fork-exec combination. > > So, be aware: do not use vfork, if you don't exec right after it! > Don't use it even then! The only functions a vfork()ed child process can call are an exec*() one or _exit() (And then I think only execv() and execve() are safe). It can't return from the function vfork() was called in. It can't safely modify variables. In other words, it can't do any error handling to speak of if the exec fails. Sure, it's faster than a fork() (Even on a OS that does copy-on-right memory pages -- which most modern ones do) because you don't copy process table structures.... but it's way too fragile when something goes wrong. Which will happen, sooner or later. -- Shawn W. shawnw@speakeasy.org