From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA01606; Mon, 19 May 2003 12:04:03 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA00543 for ; Mon, 19 May 2003 12:04:01 +0200 (MET DST) Received: from fort-point-station.mit.edu (FORT-POINT-STATION.MIT.EDU [18.7.7.76]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4JA41H22249 for ; Mon, 19 May 2003 12:04:01 +0200 (MET DST) Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by fort-point-station.mit.edu (8.12.4/8.9.2) with ESMTP id h4JA40Th016619; Mon, 19 May 2003 06:04:00 -0400 (EDT) Received: from melbourne-city-street.mit.edu (MELBOURNE-CITY-STREET.MIT.EDU [18.7.21.86]) by central-city-carrier-station.mit.edu (8.12.4/8.9.2) with ESMTP id h4JA3xnd003541; Mon, 19 May 2003 06:03:59 -0400 (EDT) Received: from nerd-xing.mit.edu (NERD-XING.MIT.EDU [18.7.16.74]) ) by melbourne-city-street.mit.edu (8.12.4/8.12.4) with ESMTP id h4JA3wU8028507; Mon, 19 May 2003 06:03:58 -0400 (EDT) Received: (from jfc@localhost) by nerd-xing.mit.edu (8.9.3p2) id GAA17246; Mon, 19 May 2003 06:03:58 -0400 (EDT) Message-Id: <200305191003.GAA17246@nerd-xing.mit.edu> To: "Beck01, Wolfgang" cc: caml-list@inria.fr Subject: Re: [Caml-list] different behaviour of Unix.fork on FreeBSD and Linux In-Reply-To: Your message of "Mon, 19 May 2003 11:35:59 +0200." Date: Mon, 19 May 2003 06:03:58 -0400 From: John Carr X-Spam: no; 0.00; jfc:01 caml-list:01 fork:01 descriptor:01 buffer:01 buffered:01 fflush:01 flushing:01 null:01 behaviour:01 unix:02 duplicated:04 carr:05 buffers:05 output:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk fork duplicates the buffers holding output that has not yet been written to a file descriptor. If the output buffer is not empty at the time of fork, output may be duplicated. If output is unbuffered or line buffered the program will work as in the BSD case. Otherwise you need to arrange for buffered output to be written before fork(). In C one is advised to call fflush(NULL) before fork if the child does I/O. If the child calls exec() immediately _exit() should be used instead of exit() if the exec() fails. (_exit() terminates the process without flushing I/O buffers.) ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners