All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH 2/2] Provide owner name via rt_mutex_inquire
@ 2008-07-10 13:17 Jan Kiszka
  2008-07-10 14:33 ` Gilles Chanteperdrix
  2008-07-31 16:28 ` Philippe Gerum
  0 siblings, 2 replies; 7+ messages in thread
From: Jan Kiszka @ 2008-07-10 13:17 UTC (permalink / raw)
  To: xenomai-core

This can be helpful for debugging the (futile) release attempts of
mutexes by tasks that do not own them.

Returning the RT_TASK reference may appear more consistent on first
sight, but it cannot be guaranteed that the owner is actually a native
task. Therefore this patch uses the symbolic name.

Signed-off-by: Jan Kiszka <jan.kiszka@domain.hid>
---
 include/native/mutex.h    |    3 +++
 ksrc/skins/native/mutex.c |    5 +++++
 2 files changed, 8 insertions(+)

Index: b/include/native/mutex.h
===================================================================
--- a/include/native/mutex.h
+++ b/include/native/mutex.h
@@ -38,6 +38,9 @@ typedef struct rt_mutex_info {
 
 	char name[XNOBJECT_NAME_LEN]; /**< Symbolic name. */
 
+	char owner[XNOBJECT_NAME_LEN]; /**< Symbolic name of the current owner,
+					    empty if unlocked. */
+
 } RT_MUTEX_INFO;
 
 typedef struct rt_mutex_placeholder {
Index: b/ksrc/skins/native/mutex.c
===================================================================
--- a/ksrc/skins/native/mutex.c
+++ b/ksrc/skins/native/mutex.c
@@ -597,6 +597,11 @@ int rt_mutex_inquire(RT_MUTEX *mutex, RT
 	strcpy(info->name, mutex->name);
 	info->lockcnt = mutex->lockcnt;
 	info->nwaiters = xnsynch_nsleepers(&mutex->synch_base);
+	if (mutex->lockcnt)
+		strcpy(info->owner,
+		       xnthread_name(xnsynch_owner(&mutex->synch_base)));
+	else
+		info->owner[0] = 0;
 
       unlock_and_exit:
 


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

end of thread, other threads:[~2008-07-31 16:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-10 13:17 [Xenomai-core] [PATCH 2/2] Provide owner name via rt_mutex_inquire Jan Kiszka
2008-07-10 14:33 ` Gilles Chanteperdrix
2008-07-10 15:02   ` Jan Kiszka
2008-07-10 15:11     ` Gilles Chanteperdrix
2008-07-10 15:14     ` Philippe Gerum
2008-07-11 12:54   ` Gilles Chanteperdrix
2008-07-31 16:28 ` 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.