* [Xenomai-help] problem with reading from rt_pipe with a normal linux process
@ 2006-08-02 18:46 Marco Jackel
2006-08-02 18:53 ` [Xenomai-help] " Marco Jackel
0 siblings, 1 reply; 7+ messages in thread
From: Marco Jackel @ 2006-08-02 18:46 UTC (permalink / raw)
To: xenomai
Hi,
i do the following:
- create a pipe:
rt_pipe_create (&data_pipe, "data_pipe", PIPE_MINOR, PIPE_SIZE);
- write data to the pipe:
rt_pipe_write(&data_pipe, &pipe_buf, pipe_buf_sz, P_NORMAL);
- open the pipe from a normal linux process:
pipe_fd = open(DATA_PIPE, O_RDONLY);
- read the data from the pipe:
ret = read(pipe_fd, &pipe_buf, sizeof(pipe_buf));
Opening works, but the reading doesn't work. I get the error code "-1",
Operation not permitted.
Permission for the device file is ok:
voyage:~# ls -l /dev/rtp0
crw-rw-rw- 1 root root 150, 0 Jun 21 2006 /dev/rtp0
What am I doing wrong?
Thanks
Marco
Linux voyage 2.6.16.1-03-xenomai-2.1.2 #1 PREEMPT Tue Jul 11 10:17:15
GMT 2006 i586 GNU/Linux
Gnu C 17:
util-linux 2.12p
mount 2.12p
module-init-tools 3.2-pre1
e2fsprogs 1.37
pcmcia-cs 3.2.5
PPP 2.4.3
Linux C Library 2.3.2
Dynamic linker (ldd) 2.3.2
Procps 3.2.1
Net-tools 1.60
Kbd 69:
Sh-utils 5.2.1
Modules Loaded xeno_16550A xeno_rtdm uhci_hcd ohci_hcd usbcore
dm_mod
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Xenomai-help] Re: problem with reading from rt_pipe with a normal linux process
2006-08-02 18:46 [Xenomai-help] problem with reading from rt_pipe with a normal linux process Marco Jackel
@ 2006-08-02 18:53 ` Marco Jackel
2006-08-02 18:58 ` Jan Kiszka
0 siblings, 1 reply; 7+ messages in thread
From: Marco Jackel @ 2006-08-02 18:53 UTC (permalink / raw)
To: xenomai
Mhmm, strange, I can read the data with a "cat /dev/rtp0"....
Marco Jackel wrote:
> Hi,
> i do the following:
>
> - create a pipe:
>
> rt_pipe_create (&data_pipe, "data_pipe", PIPE_MINOR, PIPE_SIZE);
>
> - write data to the pipe:
>
> rt_pipe_write(&data_pipe, &pipe_buf, pipe_buf_sz, P_NORMAL);
>
> - open the pipe from a normal linux process:
>
> pipe_fd = open(DATA_PIPE, O_RDONLY);
>
> - read the data from the pipe:
>
> ret = read(pipe_fd, &pipe_buf, sizeof(pipe_buf));
>
>
> Opening works, but the reading doesn't work. I get the error code "-1",
> Operation not permitted.
>
> Permission for the device file is ok:
>
> voyage:~# ls -l /dev/rtp0
> crw-rw-rw- 1 root root 150, 0 Jun 21 2006 /dev/rtp0
>
>
> What am I doing wrong?
>
> Thanks
> Marco
>
>
> Linux voyage 2.6.16.1-03-xenomai-2.1.2 #1 PREEMPT Tue Jul 11 10:17:15
> GMT 2006 i586 GNU/Linux
>
> Gnu C 17:
> util-linux 2.12p
> mount 2.12p
> module-init-tools 3.2-pre1
> e2fsprogs 1.37
> pcmcia-cs 3.2.5
> PPP 2.4.3
> Linux C Library 2.3.2
> Dynamic linker (ldd) 2.3.2
> Procps 3.2.1
> Net-tools 1.60
> Kbd 69:
> Sh-utils 5.2.1
> Modules Loaded xeno_16550A xeno_rtdm uhci_hcd ohci_hcd usbcore
> dm_mod
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Re: problem with reading from rt_pipe with a normal linux process
2006-08-02 18:53 ` [Xenomai-help] " Marco Jackel
@ 2006-08-02 18:58 ` Jan Kiszka
2006-08-02 19:07 ` Marco Jackel
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2006-08-02 18:58 UTC (permalink / raw)
To: Marco Jackel; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 1732 bytes --]
Marco Jackel wrote:
> Mhmm, strange, I can read the data with a "cat /dev/rtp0"....
>
Hint: read returns its error code in errno. What does that one tell you?
Jan
>
> Marco Jackel wrote:
>> Hi,
>> i do the following:
>>
>> - create a pipe:
>>
>> rt_pipe_create (&data_pipe, "data_pipe", PIPE_MINOR, PIPE_SIZE);
>>
>> - write data to the pipe:
>>
>> rt_pipe_write(&data_pipe, &pipe_buf, pipe_buf_sz, P_NORMAL);
>>
>> - open the pipe from a normal linux process:
>>
>> pipe_fd = open(DATA_PIPE, O_RDONLY);
>>
>> - read the data from the pipe:
>>
>> ret = read(pipe_fd, &pipe_buf, sizeof(pipe_buf));
>>
>>
>> Opening works, but the reading doesn't work. I get the error code "-1",
>> Operation not permitted.
>>
>> Permission for the device file is ok:
>>
>> voyage:~# ls -l /dev/rtp0
>> crw-rw-rw- 1 root root 150, 0 Jun 21 2006 /dev/rtp0
>>
>>
>> What am I doing wrong?
>>
>> Thanks
>> Marco
>>
>>
>> Linux voyage 2.6.16.1-03-xenomai-2.1.2 #1 PREEMPT Tue Jul 11 10:17:15
>> GMT 2006 i586 GNU/Linux
>>
>> Gnu C 17:
>> util-linux 2.12p
>> mount 2.12p
>> module-init-tools 3.2-pre1
>> e2fsprogs 1.37
>> pcmcia-cs 3.2.5
>> PPP 2.4.3
>> Linux C Library 2.3.2
>> Dynamic linker (ldd) 2.3.2
>> Procps 3.2.1
>> Net-tools 1.60
>> Kbd 69:
>> Sh-utils 5.2.1
>> Modules Loaded xeno_16550A xeno_rtdm uhci_hcd ohci_hcd usbcore
>> dm_mod
>
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Xenomai-help] Re: problem with reading from rt_pipe with a normal linux process
2006-08-02 18:58 ` Jan Kiszka
@ 2006-08-02 19:07 ` Marco Jackel
2006-08-02 19:38 ` Jan Kiszka
0 siblings, 1 reply; 7+ messages in thread
From: Marco Jackel @ 2006-08-02 19:07 UTC (permalink / raw)
To: xenomai
Jan Kiszka wrote:
> Hint: read returns its error code in errno. What does that one tell you?
read returns -1, "operation not permitted"
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Re: problem with reading from rt_pipe with a normal linux process
2006-08-02 19:07 ` Marco Jackel
@ 2006-08-02 19:38 ` Jan Kiszka
2006-08-03 7:10 ` Marco Jackel
0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2006-08-02 19:38 UTC (permalink / raw)
To: Marco Jackel; +Cc: xenomai
[-- Attachment #1: Type: text/plain, Size: 291 bytes --]
Marco Jackel wrote:
> Jan Kiszka wrote:
>> Hint: read returns its error code in errno. What does that one tell you?
>
> read returns -1, "operation not permitted"
>
errno == EPERM? A bit weird. Try strace'ing both your program and the
cat tool to look for a difference.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Xenomai-help] Re: problem with reading from rt_pipe with a normal linux process
2006-08-02 19:38 ` Jan Kiszka
@ 2006-08-03 7:10 ` Marco Jackel
2006-08-03 17:46 ` Philippe Gerum
0 siblings, 1 reply; 7+ messages in thread
From: Marco Jackel @ 2006-08-03 7:10 UTC (permalink / raw)
To: xenomai
Jan Kiszka wrote:
> Marco Jackel wrote:
>> Jan Kiszka wrote:
>>> Hint: read returns its error code in errno. What does that one tell you?
>> read returns -1, "operation not permitted"
>>
>
> errno == EPERM? A bit weird. Try strace'ing both your program and the
> cat tool to look for a difference.
strace says "-1" in this case is ENOBUFS
The failure in my programm is that it writes binary data to a pipe with
rt_pipe_write (preserves message boundary) and normal linux process
wants to read it byte by byte with read(). Read wants to receive the
whole message, but the message is bigger than 1 byte, so it returns ENOBUFS.
The solution is to use rt_pipe_stream (don't preserves message
boundary). Do I have to use rt_pipe_alloc before? Is there a small
sample program somewhere?
Thanks,
Marco
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Xenomai-help] Re: problem with reading from rt_pipe with a normal linux process
2006-08-03 7:10 ` Marco Jackel
@ 2006-08-03 17:46 ` Philippe Gerum
0 siblings, 0 replies; 7+ messages in thread
From: Philippe Gerum @ 2006-08-03 17:46 UTC (permalink / raw)
To: Marco Jackel; +Cc: xenomai
On Thu, 2006-08-03 at 09:10 +0200, Marco Jackel wrote:
> Jan Kiszka wrote:
> > Marco Jackel wrote:
> >> Jan Kiszka wrote:
> >>> Hint: read returns its error code in errno. What does that one tell you?
> >> read returns -1, "operation not permitted"
> >>
> >
> > errno == EPERM? A bit weird. Try strace'ing both your program and the
> > cat tool to look for a difference.
> strace says "-1" in this case is ENOBUFS
>
> The failure in my programm is that it writes binary data to a pipe with
> rt_pipe_write (preserves message boundary) and normal linux process
> wants to read it byte by byte with read(). Read wants to receive the
> whole message, but the message is bigger than 1 byte, so it returns ENOBUFS.
>
Yep. Well, I agree that this is clearly not the best designed part of
the entire interface...
> The solution is to use rt_pipe_stream (don't preserves message
> boundary). Do I have to use rt_pipe_alloc before?
No, rt_pipe_stream() manages an internal buffer to convey the byte
stream, and deals with the rt_pipe_alloc/free interface on its own. You
just need to pass it the raw data buffer and size.
> Is there a small
> sample program somewhere?
>
>
> Thanks,
> Marco
>
>
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help
--
Philippe.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2006-08-03 17:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-02 18:46 [Xenomai-help] problem with reading from rt_pipe with a normal linux process Marco Jackel
2006-08-02 18:53 ` [Xenomai-help] " Marco Jackel
2006-08-02 18:58 ` Jan Kiszka
2006-08-02 19:07 ` Marco Jackel
2006-08-02 19:38 ` Jan Kiszka
2006-08-03 7:10 ` Marco Jackel
2006-08-03 17:46 ` 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.