All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Problem with rt_pipe and user space communication
@ 2007-07-18 14:43 Mathieu JOINIE-MAURIN
  2007-07-18 17:48 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Mathieu JOINIE-MAURIN @ 2007-07-18 14:43 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 1270 bytes --]

Hi everybody,

I try to learn Xenomai. I have a problem that I do not understand. I want that my real time task to communicate with my user space task through a pipe (FIFO) in order to save sample datas in a file. My problem is the following. I create a pipe with:

err = rt_pipe_create(&pipe1,"MyPipe1",1,FIFO_SIZE_PARAM*sizeof(double));
    if(err)
    {
        printf("pipe MyPipe1 creation failure : %d\n",err);
    }

then in the real time task i write to the pipe like this:

err = rt_pipe_stream(&pipe1,&tension0,sizeof(double)); // i already try rt_pipe_write but i got the same result
        if ( err < 0 ) 
        {
        printf("rt_pipe_write erreur %d \n",err);
        }


On the user side, i am doing the following :

    double tabTest[FIFO_SIZE_PARAM];
    int nb_read;
    nb_read=read(pipe1user,tabTest,FIFO_SIZE_PARAM*sizeof(double));
    printf("I got  %d bytes\n",nb_read);


I get a value of 8 for nb_read which corresponds to sizeof(double). But i am expecting more. I do not know why the system function read(2) works like this.

Thank you in advance for your help,

Mathieu




      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 

[-- Attachment #2: Type: text/html, Size: 1822 bytes --]

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

* Re: [Xenomai-help] Problem with rt_pipe and user space communication
  2007-07-18 14:43 [Xenomai-help] Problem with rt_pipe and user space communication Mathieu JOINIE-MAURIN
@ 2007-07-18 17:48 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2007-07-18 17:48 UTC (permalink / raw)
  To: Mathieu JOINIE-MAURIN; +Cc: xenomai

On Wed, 2007-07-18 at 14:43 +0000, Mathieu JOINIE-MAURIN wrote:
> Hi everybody,
> 
> I try to learn Xenomai. I have a problem that I do not understand. I
> want that my real time task to communicate with my user space task
> through a pipe (FIFO) in order to save sample datas in a file. My
> problem is the following. I create a pipe with:

<snip>
> 
> I get a value of 8 for nb_read which corresponds to sizeof(double).
> But i am expecting more. I do not know why the system function read(2)
> works like this.
> 
The user-space side seems to read double values as soon as they are
written to the pipe (i.e. try sending two doubles in a row at each
kernel-side write op), so this behaviour would be the expected one.

Sidenote: rt_pipe_stream will not keep message boundaries (e.g. writing
8 + 4 + 4 may cause the read side to get 12 + 4); rt_pipe_send/write
will keep the boundaries intact.

> Thank you in advance for your help,
> 
> Mathieu
> 
> 
> 
> ______________________________________________________________________
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers
> Yahoo! Mail 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
-- 
Philippe.




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

end of thread, other threads:[~2007-07-18 17:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-18 14:43 [Xenomai-help] Problem with rt_pipe and user space communication Mathieu JOINIE-MAURIN
2007-07-18 17:48 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.