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 LAA32677; Mon, 19 May 2003 11:36:28 +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 LAA32400 for ; Mon, 19 May 2003 11:36:27 +0200 (MET DST) Received: from mail1.telekom.de (mail1.telekom.de [62.225.183.235]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h4J9aQH19650 for ; Mon, 19 May 2003 11:36:26 +0200 (MET DST) Received: from g9jbr.mgb01.telekom.de by G8SBV.dmz.telekom.de with ESMTP for caml-list@inria.fr; Mon, 19 May 2003 11:36:00 +0200 Received: by G9JBR.mgb01.telekom.de with Internet Mail Service (5.5.2653.19) id ; Mon, 19 May 2003 11:36:00 +0200 Message-Id: From: "Beck01, Wolfgang" To: caml-list@inria.fr Subject: [Caml-list] different behaviour of Unix.fork on FreeBSD and Linux Date: Mon, 19 May 2003 11:35:59 +0200 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" X-Spam: no; 0.00; t-systems:01 fork:01 printf:01 3.02:01 3.06:01 ocaml:01 behaviour:01 father:97 unix:02 wolfgang:02 let:04 beck:04 output:05 recompiling:06 loop:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, while recompiling an OCaml program developed under FrreeBSD in Linux, I had some problems. What is the output of the following OCaml program? open Printf open Unix let ftst() = let pid = fork() in if pid = 0 then printf "son\n" else begin printf "father\n"; let _= wait() in () end let aa = printf "test\n" let main() = printf "main\n"; ftst() ;; main() On FreeBSD (OCaml 3.02), it is what I expected test main father son However, on Linux (OCaml 3.06), it is test main son test <-- why? main <-- why? father It looks as if the fork causes a second program initialization. Strange that this doesn't result in an endless loop. Any ideas? -- Wolfgang Beck T-Systems Nova GmbH ------------------- 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