* [Xenomai-help] rt_queue_read and EPERM?
@ 2010-09-13 8:06 Jens Köhler
2010-09-13 9:07 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Jens Köhler @ 2010-09-13 8:06 UTC (permalink / raw)
To: xenomai
[-- Attachment #1: Type: text/plain, Size: 352 bytes --]
Hello
I am try to use a RT_QUEUE. I am writing messages with rt_queue_write to the
queue. But when function rt_queue_read is called result is always "-1".
"-1" means EPERM. What means exactly: "EEPERM is returned if this service
should block"? I don't understand why a function should block to get a
message from a queue!?
Thanks and regards,
Jens,
[-- Attachment #2: Type: text/html, Size: 708 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] rt_queue_read and EPERM?
2010-09-13 8:06 [Xenomai-help] rt_queue_read and EPERM? Jens Köhler
@ 2010-09-13 9:07 ` Gilles Chanteperdrix
2010-09-13 10:59 ` Jens Köhler
0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2010-09-13 9:07 UTC (permalink / raw)
To: Jens Köhler; +Cc: xenomai
Jens Köhler wrote:
> Hello
>
> I am try to use a RT_QUEUE. I am writing messages with rt_queue_write to
> the queue. But when function rt_queue_read is called result is always "-1".
>
> "-1" means EPERM. What means exactly: "EEPERM is returned if this
> service should block"? I don't understand why a function should block to
> get a message from a queue!?
A piece of code is worth a thousand words. Please send us a piece of
code showing the behaviour you find suspicious.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] rt_queue_read and EPERM?
2010-09-13 9:07 ` Gilles Chanteperdrix
@ 2010-09-13 10:59 ` Jens Köhler
2010-09-13 11:57 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Jens Köhler @ 2010-09-13 10:59 UTC (permalink / raw)
To: Gilles Chanteperdrix, xenomai
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
Hello Gilles,
here is the code:
RT_QUEUE myqueue;
int retval;
retval = rt_queue_create(&myqueue, "myqueue", 255, 10, Q_FIFO);
char message[100] = "Message ";
retval = rt_queue_write(&myqueue,message,sizeof(message),Q_NORMAL);
//retval is 0
char msgBuf[255];
retval = rt_queue_read(&myqueue, msgBuf, sizeof(msgBuf), TM_NONBLOCK);
//retval is always -1, why?
regards,
Jens
2010/9/13 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
> Jens Köhler wrote:
> > Hello
> >
> > I am try to use a RT_QUEUE. I am writing messages with rt_queue_write to
> > the queue. But when function rt_queue_read is called result is always
> "-1".
> >
> > "-1" means EPERM. What means exactly: "EEPERM is returned if this
> > service should block"? I don't understand why a function should block to
> > get a message from a queue!?
>
> A piece of code is worth a thousand words. Please send us a piece of
> code showing the behaviour you find suspicious.
>
> --
> Gilles.
>
>
[-- Attachment #2: Type: text/html, Size: 1712 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] rt_queue_read and EPERM?
2010-09-13 10:59 ` Jens Köhler
@ 2010-09-13 11:57 ` Gilles Chanteperdrix
2010-09-13 13:52 ` Jens Köhler
0 siblings, 1 reply; 6+ messages in thread
From: Gilles Chanteperdrix @ 2010-09-13 11:57 UTC (permalink / raw)
To: Jens Köhler; +Cc: xenomai
Jens Köhler wrote:
> Hello Gilles,
>
> here is the code:
>
> RT_QUEUE myqueue;
> int retval;
> retval = rt_queue_create(&myqueue, "myqueue", 255, 10, Q_FIFO);
>
> char message[100] = "Message ";
> retval = rt_queue_write(&myqueue,message,sizeof(message),Q_NORMAL);
> //retval is 0
>
> char msgBuf[255];
> retval = rt_queue_read(&myqueue, msgBuf, sizeof(msgBuf), TM_NONBLOCK);
> //retval is always -1, why?
Probably because the callling thread is not a Xenomai thread, it is a
simple Linux thread, and as such, is not allowed to switch to primary
mode as is required by rt_queue_read.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] rt_queue_read and EPERM?
2010-09-13 11:57 ` Gilles Chanteperdrix
@ 2010-09-13 13:52 ` Jens Köhler
2010-09-13 14:15 ` Gilles Chanteperdrix
0 siblings, 1 reply; 6+ messages in thread
From: Jens Köhler @ 2010-09-13 13:52 UTC (permalink / raw)
To: Gilles Chanteperdrix, xenomai
[-- Attachment #1: Type: text/plain, Size: 851 bytes --]
Yes this is true. It is not a Xenomai task.
Many thanks,
Jens
2010/9/13 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
> Jens Köhler wrote:
> > Hello Gilles,
> >
> > here is the code:
> >
> > RT_QUEUE myqueue;
> > int retval;
> > retval = rt_queue_create(&myqueue, "myqueue", 255, 10, Q_FIFO);
> >
> > char message[100] = "Message ";
> > retval = rt_queue_write(&myqueue,message,sizeof(message),Q_NORMAL);
> > //retval is 0
> >
> > char msgBuf[255];
> > retval = rt_queue_read(&myqueue, msgBuf, sizeof(msgBuf), TM_NONBLOCK);
> > //retval is always -1, why?
>
> Probably because the callling thread is not a Xenomai thread, it is a
> simple Linux thread, and as such, is not allowed to switch to primary
> mode as is required by rt_queue_read.
>
> --
> Gilles.
>
>
[-- Attachment #2: Type: text/html, Size: 1286 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Xenomai-help] rt_queue_read and EPERM?
2010-09-13 13:52 ` Jens Köhler
@ 2010-09-13 14:15 ` Gilles Chanteperdrix
0 siblings, 0 replies; 6+ messages in thread
From: Gilles Chanteperdrix @ 2010-09-13 14:15 UTC (permalink / raw)
To: Jens Köhler; +Cc: xenomai
Jens Köhler wrote:
> Yes this is true. It is not a Xenomai task.
The documentation is a bit misleading, I agree, the paragram about
-EPERM is for kernel mode usage of rt_queue_read. In user-space mode,
EPERM is returned if the calling thread is not a Xenomai thread, before
even testing whether a message is available.
--
Gilles.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-09-13 14:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-13 8:06 [Xenomai-help] rt_queue_read and EPERM? Jens Köhler
2010-09-13 9:07 ` Gilles Chanteperdrix
2010-09-13 10:59 ` Jens Köhler
2010-09-13 11:57 ` Gilles Chanteperdrix
2010-09-13 13:52 ` Jens Köhler
2010-09-13 14:15 ` Gilles Chanteperdrix
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.