caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Virgile Prevosto <virgile.prevosto@m4x.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Named pipe problem: is this a bug?
Date: Mon, 1 Aug 2005 17:41:28 +0200	[thread overview]
Message-ID: <20050801174128.29155ecb@mpiat2305> (raw)
In-Reply-To: <F0577640-623F-4147-9745-300F4303D3E6@polytechnique.org>

Le 08/01/2005, à 05:03:42 PM, Alan Schmitt a écrit:
> let _ =
>    Unix.mkfifo "pipe_test" 0o640;
>    print_endline "pipe created";
>    flush stdout;
>    let chin = open_in "pipe_test" in
>      print_endline "pipe opened";
>      flush stdout
> 
> Compile it using "ocamlc unix.cma bug.ml" (the bug occurs both in  
> 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.
> 
> Is this behaviour normal?
> 

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?
-- 
E tutto per oggi, a la prossima volta
Virgile


  reply	other threads:[~2005-08-01 15:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-01 15:03 Alan Schmitt
2005-08-01 15:41 ` Virgile Prevosto [this message]
2005-08-01 15:42 ` [Caml-list] " Damien Bobillot
2005-08-01 15:55 ` Richard Jones
2005-08-02  7:59 ` Alan Schmitt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050801174128.29155ecb@mpiat2305 \
    --to=virgile.prevosto@m4x.org \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).