Problem using sem_open and rt_sem_create
Hi *,
I'm fairly new to Xenomai and am having a few issues and was wondering if anyone could provide me with help
I have written some code to create a process which waits on a named semaphore and then there is another process which posts to it. I originally developed the code using the posix interface under a standard Linux environment and have proved it works.
I have since ported the code so that the waiting half creates and waits on the semaphore using the native skin and the posting half uses the posix skin.
I tried naming the semaphore using the leading '/' as the posix standard suggests, but found that using the '/' causes the rt_sem_create(&rt_sem, SEM_NAME, 0, S_PULSE) to return EINVAL. Removing the '/' allows the semaphore to be created but now when I try to open the semaphore with sem_open(SEM_NAME, O_EXCL), I get an error that the file doesn't exist. Is there something that I'm missing? I've check the registry and the semaphore appears under /proc/xenomai/registry/native/semaphores/.
Thanks,
Dan Adams
Quoted 13 lines · Daniel Adams
Hi *,
I'm fairly new to Xenomai and am having a few issues and was wondering if anyone could provide me with help
I have written some code to create a process which waits on a named semaphore and then there is another process which posts to it. I originally developed the code using the posix interface under a standard Linux environment and have proved it works.
I have since ported the code so that the waiting half creates and waits on the semaphore using the native skin and the posting half uses the posix skin.
Quoted 7 lines
I tried naming the semaphore using the leading '/' as the posix standard suggests, but found that using the '/' causes the
rt_sem_create(&rt_sem, SEM_NAME, 0, S_PULSE)to return EINVAL. Removing the '/' allows the semaphore to be created but now when I try to open the semaphore withsem_open(SEM_NAME, O_EXCL), I get an error that the file doesn't exist. Is there something that I'm missing? I've check the registry and the semaphore appears under/proc/xenomai/registry/native/semaphores/.
The objects created by the two skins are completely separate.
Signature · 1 line
Gilles.
Thanks Gillies,
Is it possible to use the rt_sem_bind from a linux process that hasn't been shadowed using rt_task_shadow?
Is this the same for named pipes created using the native skin and accessing them from a posix interface?
What is the recommended IPC to talk between posix threads and native rt threads?
Thanks again for your help.
Quoted 30 lines · Gilles Chanteperdrix
Quoted 7 lines · Daniel Adams
Hi *,
I'm fairly new to Xenomai and am having a few issues and was wondering if anyone could provide me with help
I have written some code to create a process which waits on a named semaphore and then there is another process which posts to it. I
originally
Quoted 3 lines
developed the code using the posix interface under a standard Linux environment and have proved it works.
I have since ported the code so that the waiting half creates and waitson
Quoted 8 lines
the semaphore using the native skin and the posting half uses the posix skin.
I tried naming the semaphore using the leading '/' as the posix standard suggests, but found that using the '/' causes the
rt_sem_create(&rt_sem, SEM_NAME, 0, S_PULSE)to return EINVAL. Removing the '/' allows the semaphore to be created but now when I try to open the semaphore withsem_open(SEM_NAME, O_EXCL), I get an error that the file doesn'texist.
Quoted 2 lines
Is there something that I'm missing? I've check the registry and the semaphore appears under
/proc/xenomai/registry/native/semaphores/.The objects created by the two skins are completely separate.
--
Gilles.
Quoted 4 lines · Daniel Adams
Thanks Gillies,
Is it possible to use the
rt_sem_bindfrom a linux process that hasn't been shadowed usingrt_task_shadow?
No. If you read the documentation of rt_sem_bind, you will see:
Environments:
This service can be called from:
* User-space task (switches to primary mode)
And to switch to primary mode, task needs to be shadowed with rt_task_shadow.
Quoted 2 lines
Is this the same for named pipes created using the native skin and accessing them from a posix interface?
The non real-time side of named pipes may be accessed using the Linux posix interface, not Xenomai posix skin interface.
Quoted 3 lines
What is the recommended IPC to talk between posix threads and native rt threads?
It depends if you are talking about (non real-time) Linux posix threads, or (real-time) Xenomai posix skin threads.
If you are talking about Linux posix threads, then what you are looking for is rt_pipes.
If you are talking about Xenomai posix skin threads, then mostly any IPC of both skins may be used. Only, you have to use the same interface with both skins. So, for instance, if you choose Xenomai posix skin message queues, you have to use mq_open, mq_send, mq_receive, mq_close, mq_unlink with the threads of the two skins.
Signature · 1 line
Gilles.