Skip to contentSkip to conversation

problem with mutexes between kernel and user-space

Xenomai-help Dr. Kiriakos Athanasas 2 participants 2 messages May 15, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

I had an application which run under kernel 2.6.26 and xeno 2.4.6 without any problems.

I tried now kernel 2.6.28.7 and xeno 2.5.1 and have the following problem:

inside a kernel module I create a mutex for locking an shared memory. from an user-task I want now to

communicate over the protected shm. Therefore I bind to the mutex of the kernel-space

when I call rt_mutex_acquire I get the failure EIDRM. Why the mutex seems to be deleted?

rt_mutex_release causes a segmentation fault.

What is my mistake?

Here the code description of user space (it is really simple):

err = rt_mutex_create(&eca_mutex,"Mutex1");

.

err = rt_mutex_bind(&eca_mutex," Mutex1",TM_INFINITE);

.

err = rt_mutex_acquire(&eca_mutex, TM_INFINITE); // lock mutex

memcpy(.);

err = rt_mutex_release(&eca_mutex); // unlock mutex

.

Best regards

Kiriakos

#1 lore raw
Quoted 14 lines · Dr. Kiriakos Athanasas

I had an application which run under kernel 2.6.26 and xeno 2.4.6 without any problems.
I tried now kernel 2.6.28.7 and xeno 2.5.1 and have the following problem:

inside a kernel module I create a mutex for locking an shared memory. from an user-task I want now to

communicate over the protected shm. Therefore I bind to the mutex of the kernel-space

when I call rt_mutex_acquire I get the failure EIDRM. Why the mutex seems to be deleted?

Quoted 8 lines

rt_mutex_release causes a segmentation fault.

What is my mistake?

Here the code description of user space (it is really simple):

err = rt_mutex_create(&eca_mutex,"Mutex1");

You said above that you created the mutex in kernel space. So why does this line appear in your user application? Remove this line and try again.

Quoted 8 lines

err = rt_mutex_bind(&eca_mutex," Mutex1",TM_INFINITE);

err = rt_mutex_acquire(&eca_mutex, TM_INFINITE); // lock mutex

memcpy(.);

err = rt_mutex_release(&eca_mutex); // unlock mutex

Signature · 1 line
Sebastian