All of lore.kernel.org
 help / color / mirror / Atom feed
* Questions about XDDP.
@ 2020-06-04 14:14 孙世龙
  2020-06-05 15:35 ` Jan Kiszka
  0 siblings, 1 reply; 2+ messages in thread
From: 孙世龙 @ 2020-06-04 14:14 UTC (permalink / raw)
  To: xenomai

As per the documentation
(
*https://xenomai.org/documentation/xenomai-3/html/xeno3prm/
<https://xenomai.org/documentation/xenomai-3/html/xeno3prm/>group__trank.html#details*),i
can draw the conclusion that
the non real-time side could block upon attempt to open the
special device file until the corresponding one is opened
from a Xenomai thread,unless *O_NONBLOCK *was given to the
open(2) system call.Could you tell the reasons lie behind?
Why does the non real-time side need to be blocked while the
corresponding one has not been opened from a Xenomai thread?





*In addition, I found that it could returned immediately indeed if the non
real-time side is opened(2) with O_NONBLOCK as described in the
documentation, but it also returned the errorwhich says:"open rtp0 returned
error: Resource temporarily unavailable".*
I do this experiment on Ubuntu16.04(kernel 4.19.84 + xenomai3.1).
The related code is listed below.I thought over and over, but i
can not understand it.
I would be grateful to have some help with this question.

One more unimportant question,through some tests, I found that *XDD*
could not be used to communicate between two linux threads .
Am i right?

Thank you for your attention.
Look forward to hearing from you.


#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define XDDP_PORT 0

static void fail(const char *reason)
{
    perror(reason);
    exit(EXIT_FAILURE);
}

int main()
{

    char buf[128];
    memset(buf,0,sizeof(buf));
    int fd, ret,outwrite;

    fd = open("/dev/rtp0", O_WRONLY|O_NONBLOCK);

    if(fd<0)
{
fail("open rtp0 returned error:");
}

    for(;;)
    {
         outwrite=write(fd,buf,sizeof(buf));
    }
}

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

* Re: Questions about XDDP.
  2020-06-04 14:14 Questions about XDDP 孙世龙
@ 2020-06-05 15:35 ` Jan Kiszka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Kiszka @ 2020-06-05 15:35 UTC (permalink / raw)
  To: 孙世龙, xenomai

On 04.06.20 16:14, 孙世龙 via Xenomai wrote:
> As per the documentation
> (
> *https://xenomai.org/documentation/xenomai-3/html/xeno3prm/
> <https://xenomai.org/documentation/xenomai-3/html/xeno3prm/>group__trank.html#details*),i
> can draw the conclusion that
> the non real-time side could block upon attempt to open the
> special device file until the corresponding one is opened
> from a Xenomai thread,unless *O_NONBLOCK *was given to the
> open(2) system call.Could you tell the reasons lie behind?
> Why does the non real-time side need to be blocked while the
> corresponding one has not been opened from a Xenomai thread?
> 

That is a valid question. The simple answer is: It's like that since at
least 2005, likely longer.

Without looking into the details, I would say it should be doable also
differently, likely not trivially, but no one requested a change so far.

> 
> 
> *In addition, I found that it could returned immediately indeed if the non
> real-time side is opened(2) with O_NONBLOCK as described in the
> documentation, but it also returned the errorwhich says:"open rtp0 returned
> error: Resource temporarily unavailable".*

EAGAIN, that is a the normal return code of a POSIX service that would
block but was told to not do that.

> I do this experiment on Ubuntu16.04(kernel 4.19.84 + xenomai3.1).
> The related code is listed below.I thought over and over, but i
> can not understand it.
> I would be grateful to have some help with this question.
> 
> One more unimportant question,through some tests, I found that *XDD*
> could not be used to communicate between two linux threads .
> Am i right?

Correct. One peer is always a Xenomai thread using the real-time API to
access the XDDP channel.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


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

end of thread, other threads:[~2020-06-05 15:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-04 14:14 Questions about XDDP 孙世龙
2020-06-05 15:35 ` Jan Kiszka

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.