* [Xenomai-help] Interprocess Mutex @ 2008-11-20 8:55 Adrian Boeing 2008-11-20 12:48 ` Gilles Chanteperdrix 0 siblings, 1 reply; 4+ messages in thread From: Adrian Boeing @ 2008-11-20 8:55 UTC (permalink / raw) To: xenomai [-- Attachment #1: Type: text/plain, Size: 256 bytes --] Hi, Is it possible to create an inter-process mutex between kernel space and user space? If so, how is this done with the native API? The system has one real-time kernel process which communicates with other processes via shared memory. Thanks, -Adrian [-- Attachment #2: Type: text/html, Size: 282 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-help] Interprocess Mutex 2008-11-20 8:55 [Xenomai-help] Interprocess Mutex Adrian Boeing @ 2008-11-20 12:48 ` Gilles Chanteperdrix 2008-11-21 0:03 ` Adrian Boeing 0 siblings, 1 reply; 4+ messages in thread From: Gilles Chanteperdrix @ 2008-11-20 12:48 UTC (permalink / raw) To: Adrian Boeing; +Cc: xenomai Adrian Boeing wrote: > Hi, > > Is it possible to create an inter-process mutex between kernel space and > user space? > If so, how is this done with the native API? > > The system has one real-time kernel process which communicates with other > processes via shared memory. See rt_mutex_bind: http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__mutex.html#g39b3a0e7f6f6ee41b8068ed59e25d1d1 or, for the posix skin, pthread_mutexattr_setpshared: http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__posix__mutex.html#g73bd8697b91e0ee9a63c30052ac9f72f Note that for sharing a mutex with the posix skin, the pthread_mutex_t structure needs to reside on a shared memory. -- Gilles. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-help] Interprocess Mutex 2008-11-20 12:48 ` Gilles Chanteperdrix @ 2008-11-21 0:03 ` Adrian Boeing 2008-11-21 2:43 ` Philippe Gerum 0 siblings, 1 reply; 4+ messages in thread From: Adrian Boeing @ 2008-11-21 0:03 UTC (permalink / raw) To: Gilles Chanteperdrix; +Cc: xenomai [-- Attachment #1: Type: text/plain, Size: 1523 bytes --] Hi Gilles, thanks for the reply. In my test (pseudo) code with rt_mutex: (without bind): int main() { err = rt_mutex_create(&mutex_desc,0); err = rt_mutex_acquire(&mutex_desc,TM_INFINITE); //fails with -1! } (with bind): int main() { err = rt_mutex_create(&Kmutex_desc,"bob"); err = rt_mutex_bind(&mutex_desc,"bob",TM_INFINITE); err = rt_mutex_acquire(&mutex_desc,TM_INFINITE); //fails with -1! } Both of these fail to acquire the mutex with "EPERM" :: (this service was called from a context which cannot be given the ownership of the mutex). Is there something special I need to do in order to do this in user space? Thanks, -Adrian On Thu, Nov 20, 2008 at 9:48 PM, Gilles Chanteperdrix < gilles.chanteperdrix@xenomai.org> wrote: > > Adrian Boeing wrote: > > Hi, > > > > Is it possible to create an inter-process mutex between kernel space and > > user space? > > If so, how is this done with the native API? > > > > The system has one real-time kernel process which communicates with other > > processes via shared memory. > > See rt_mutex_bind: > > http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__mutex.html#g39b3a0e7f6f6ee41b8068ed59e25d1d1 > or, for the posix skin, pthread_mutexattr_setpshared: > > http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__posix__mutex.html#g73bd8697b91e0ee9a63c30052ac9f72f > Note that for sharing a mutex with the posix skin, the pthread_mutex_t > structure needs to reside on a shared memory. > > -- > Gilles. > > [-- Attachment #2: Type: text/html, Size: 2428 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Xenomai-help] Interprocess Mutex 2008-11-21 0:03 ` Adrian Boeing @ 2008-11-21 2:43 ` Philippe Gerum 0 siblings, 0 replies; 4+ messages in thread From: Philippe Gerum @ 2008-11-21 2:43 UTC (permalink / raw) To: Adrian Boeing; +Cc: xenomai Adrian Boeing wrote: > Hi Gilles, thanks for the reply. > > In my test (pseudo) code with rt_mutex: > (without bind): > int main() { err = rt_task_shadow(...); > err = rt_mutex_create(&mutex_desc,0); > err = rt_mutex_acquire(&mutex_desc,TM_INFINITE); //fails with -1! > } > (with bind): > int main() { err = rt_task_shadow(...); > err = rt_mutex_create(&Kmutex_desc,"bob"); > err = rt_mutex_bind(&mutex_desc,"bob",TM_INFINITE); > err = rt_mutex_acquire(&mutex_desc,TM_INFINITE); //fails with -1! > } > > Both of these fail to acquire the mutex with "EPERM" :: (this service > was called from a context which cannot be given the ownership of the mutex). > > Is there something special I need to do in order to do this in user space? > Those Xenomai syscalls are only available to Xenomai threads; rt_task_shadow() turns a regular Linux pthread into a Xenomai-enabled RT thread. rt_task_shadow() has to be called once when you don't want to spawn a new RT task using the rt_task_create() interface, but promote the current Linux pthread to the Xenomai real-time domain. In short, it associates a Xenomai task control block to the underlying Linux task, so that both Xenomai and Linux schedulers can handle it. > Thanks, > -Adrian > > On Thu, Nov 20, 2008 at 9:48 PM, Gilles Chanteperdrix > <gilles.chanteperdrix@xenomai.org > <mailto:gilles.chanteperdrix@xenomai.org>> wrote: > > > Adrian Boeing wrote: > > Hi, > > > > Is it possible to create an inter-process mutex between kernel > space and > > user space? > > If so, how is this done with the native API? > > > > The system has one real-time kernel process which communicates > with other > > processes via shared memory. > > See rt_mutex_bind: > http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__mutex.html#g39b3a0e7f6f6ee41b8068ed59e25d1d1 > or, for the posix skin, pthread_mutexattr_setpshared: > http://www.xenomai.org/documentation/branches/v2.4.x/html/api/group__posix__mutex.html#g73bd8697b91e0ee9a63c30052ac9f72f > Note that for sharing a mutex with the posix skin, the pthread_mutex_t > structure needs to reside on a shared memory. > > -- > Gilles. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Xenomai-help mailing list > Xenomai-help@domain.hid > https://mail.gna.org/listinfo/xenomai-help -- Philippe. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-21 2:43 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-11-20 8:55 [Xenomai-help] Interprocess Mutex Adrian Boeing 2008-11-20 12:48 ` Gilles Chanteperdrix 2008-11-21 0:03 ` Adrian Boeing 2008-11-21 2:43 ` 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.