From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 48937BB88 for ; Mon, 1 Aug 2005 17:41:31 +0200 (CEST) Received: from interferon.mpi-sb.mpg.de (mailhost.mpi-inf.mpg.de [139.19.1.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j71FfUEf012713 for ; Mon, 1 Aug 2005 17:41:31 +0200 Received: from amavis by interferon.mpi-sb.mpg.de with scanned-ok (Exim 3.36 #1 (Debian)) id 1DzcPy-0007Lq-00 for ; Mon, 01 Aug 2005 17:41:30 +0200 Received: from maildist ([139.19.90.238] helo=mpi-sb.mpg.de) by interferon.mpi-sb.mpg.de with esmtp (Exim 3.36 #1 (Debian)) id 1DzcPx-0007LR-00 for ; Mon, 01 Aug 2005 17:41:29 +0200 Received: from mpiat2305 (Debian-exim@mpiat2305 [139.19.20.94]) by mpi-sb.mpg.de (8.12.10+Sun/8.12.10) with ESMTP id j71FfSud009801 for ; Mon, 1 Aug 2005 17:41:28 +0200 (MEST) Received: from loopback.mpi-sb.mpg.de ([127.0.0.1] helo=mpiat2305 ident=prevosto) by mpiat2305 with esmtp (Exim 4.50) id 1DzcPw-0008MS-Ie for caml-list@yquem.inria.fr; Mon, 01 Aug 2005 17:41:28 +0200 Date: Mon, 1 Aug 2005 17:41:28 +0200 From: Virgile Prevosto To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Named pipe problem: is this a bug? Message-ID: <20050801174128.29155ecb@mpiat2305> In-Reply-To: References: X-Mailer: Sylpheed-Claws 1.0.0 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by AMaViS perl-11 X-Miltered: at nez-perce with ID 42EE42AA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 bug:01 schmitt:01 endline:01 stdout:01 endline:01 stdout:01 ocamlc:01 bug:01 bytecode:01 foo:01 corresponds:01 non-blocking:01 nonblock:01 wronly:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Le 08/01/2005, =E0 05:03:42 PM, Alan Schmitt a =E9crit: > let _ =3D > Unix.mkfifo "pipe_test" 0o640; > print_endline "pipe created"; > flush stdout; > let chin =3D open_in "pipe_test" in > print_endline "pipe opened"; > flush stdout >=20 > Compile it using "ocamlc unix.cma bug.ml" (the bug occurs both in =20 > bytecode and native code). When a.out is run, one sees: > pipe created > and the program keeps running. If one then does a > echo foo >> pipe_test > then the "pipe opened" line is shown, and the program terminates. >=20 > Is this behaviour normal? >=20 Hello Allan, this corresponds to what the manual page of fifo says (at least under linux) The FIFO must be opened on both ends (reading and writing) before data can be passed. Normally, opening the FIFO blocks until the other end is opened also. If you don't want that behavior, you'll have to open pipe_test in non-blocking mode (e.g. with open_in_gen and the Open_nonblock flag) By the way, what is the purpose of the Open_rdonly and Open_wronly flags, given that the open_in* and open_out* functions return values of different types? --=20 E tutto per oggi, a la prossima volta Virgile