caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* opening/reading a rtai fifo
@ 2006-05-24 16:47 julien.michel
  2006-05-24 17:14 ` [Caml-list] " Basile STARYNKEVITCH
  2006-05-24 17:20 ` Eric Cooper
  0 siblings, 2 replies; 4+ messages in thread
From: julien.michel @ 2006-05-24 16:47 UTC (permalink / raw)
  To: caml-list

Hello,
I currently work on an embedded system, OS Linux 2.4-19 RTAI .

I'd like to open and read out an RTAI FIFO (called /dev/rtf/0)
I used to do it with a "C" code such like:
fd = open("/dev/rtf/0",O_RDONLY);
read(fd,&f,sizeof(...)); etc...

For now, I would like to do that with Ocaml. For instance, to begin, a reading
of the FIFO's first line:

let c = open_in "/dev/rtf/0" in
let s = input_line c in
print_string s;
close_in c;

While executing this code, the application seems to run continuously, without
printing anything out whereas it works while using a single text file instead of
the fifo.
It behaves like if the input_line function failed to get the end of line
character or whatever...
The same thing occurs using the "input_char" or "open_in_bin" functions...

Would anybody know the convenient functions to perform that ?

Thanks a lot


-- 
MICHEL Julien








^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] opening/reading a rtai fifo
  2006-05-24 16:47 opening/reading a rtai fifo julien.michel
@ 2006-05-24 17:14 ` Basile STARYNKEVITCH
  2006-05-24 17:20 ` Eric Cooper
  1 sibling, 0 replies; 4+ messages in thread
From: Basile STARYNKEVITCH @ 2006-05-24 17:14 UTC (permalink / raw)
  To: julien.michel; +Cc: caml-list

Le Wed, May 24, 2006 at 06:47:33PM +0200, julien.michel@etu.univ-orleans.fr écrivait/wrote:
> Hello,
> I currently work on an embedded system, OS Linux 2.4-19 RTAI .
> 
> I'd like to open and read out an RTAI FIFO (called /dev/rtf/0)
> I used to do it with a "C" code such like:
> fd = open("/dev/rtf/0",O_RDONLY);
> read(fd,&f,sizeof(...)); etc...
> 
> For now, I would like to do that with Ocaml. For instance, to begin, a reading
> of the FIFO's first line:
> 
> let c = open_in "/dev/rtf/0" in
> let s = input_line c in
> print_string s;
> close_in c;
> 
> While executing this code, the application seems to run continuously, without
> printing anything out whereas it works while using a single text file instead of
> the fifo.

Julien probably forgot a 
   flush stdout 
at the end of his code. I sent him a longer email privately in french.

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] opening/reading a rtai fifo
  2006-05-24 16:47 opening/reading a rtai fifo julien.michel
  2006-05-24 17:14 ` [Caml-list] " Basile STARYNKEVITCH
@ 2006-05-24 17:20 ` Eric Cooper
  2006-05-24 17:32   ` Basile STARYNKEVITCH
  1 sibling, 1 reply; 4+ messages in thread
From: Eric Cooper @ 2006-05-24 17:20 UTC (permalink / raw)
  To: caml-list

On Wed, May 24, 2006 at 06:47:33PM +0200, julien.michel@etu.univ-orleans.fr wrote:
> I currently work on an embedded system, OS Linux 2.4-19 RTAI .
> 
> I'd like to open and read out an RTAI FIFO (called /dev/rtf/0)
> I used to do it with a "C" code such like:
> fd = open("/dev/rtf/0",O_RDONLY);
> read(fd,&f,sizeof(...)); etc...
> 
> For now, I would like to do that with Ocaml.
> [...]

I suggest using the Unix.openfile and Unix.read functions them same
way your current C code does, rather than the buffered I/O in stdlib.

-- 
Eric Cooper             e c c @ c m u . e d u


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Caml-list] opening/reading a rtai fifo
  2006-05-24 17:20 ` Eric Cooper
@ 2006-05-24 17:32   ` Basile STARYNKEVITCH
  0 siblings, 0 replies; 4+ messages in thread
From: Basile STARYNKEVITCH @ 2006-05-24 17:32 UTC (permalink / raw)
  To: Eric Cooper; +Cc: caml-list

Le Wed, May 24, 2006 at 01:20:05PM -0400, Eric Cooper écrivait/wrote:
> On Wed, May 24, 2006 at 06:47:33PM +0200, julien.michel@etu.univ-orleans.fr wrote:
> > I currently work on an embedded system, OS Linux 2.4-19 RTAI .
> 
> I suggest using the Unix.openfile and Unix.read functions them same
> way your current C code does, rather than the buffered I/O in stdlib.

I actually had a phone conversation and he had trouble compiling the unix
library on his system (lacking of dlopen at least, and maybe of some unix
system call).

-- 
Basile STARYNKEVITCH         http://starynkevitch.net/Basile/ 
email: basile<at>starynkevitch<dot>net 
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Faïencerie, 92340 Bourg La Reine, France


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-05-24 17:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-24 16:47 opening/reading a rtai fifo julien.michel
2006-05-24 17:14 ` [Caml-list] " Basile STARYNKEVITCH
2006-05-24 17:20 ` Eric Cooper
2006-05-24 17:32   ` Basile STARYNKEVITCH

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).