public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH 1/2] lib/alchemy: fix rt_mutex_create return values
@ 2017-07-17 14:38 Henning Schild
  2017-07-17 14:38 ` [PATCH] meta: dpkg: remove redundant 'addtask' Henning Schild
  2017-07-17 14:38 ` [PATCH 2/2] lib/alchemy: change API context tags Henning Schild
  0 siblings, 2 replies; 5+ messages in thread
From: Henning Schild @ 2017-07-17 14:38 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

From: Henning Schild <henning.schild@siemens.com>

rt_mutex_create turned an -EPERM from the cobalt kernel syscall path
into an -EEXIST. If you have a model where threads create their
shadows on demand, when seeing the first -EPERM, that return value
must not be changed.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 lib/alchemy/mutex.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/alchemy/mutex.c b/lib/alchemy/mutex.c
index 3aa55dd521..8c5e5f5968 100644
--- a/lib/alchemy/mutex.c
+++ b/lib/alchemy/mutex.c
@@ -96,7 +96,8 @@ static struct registry_operations registry_ops;
  * registered mutex.
  *
  * - -EPERM is returned if this service was called from an
- * asynchronous context.
+ * asynchronous context. Or - in dual kernel - when the thread is not
+ * allowed to issue syscalls.
  *
  * @apitags{mode-unrestricted, switch-secondary}
  *
@@ -147,12 +148,16 @@ int rt_mutex_create(RT_MUTEX *mutex, const char *name)
 		ret = 0;
 	}
 
-	if (syncluster_addobj(&alchemy_mutex_table, mcb->name, &mcb->cobj)) {
+	if (ret = syncluster_addobj(&alchemy_mutex_table, mcb->name,
+				    &mcb->cobj))
+	{
 		registry_destroy_file(&mcb->fsobj);
 		xnfree(mcb);
-		ret = -EEXIST;
-	} else
+		if (ret != -EPERM)
+			ret = -EEXIST;
+	} else {
 		mutex->handle = mainheap_ref(mcb, uintptr_t);
+	}
 out:
 	CANCEL_RESTORE(svc);
 
-- 
2.13.0


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

end of thread, other threads:[~2017-07-22 22:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-17 14:38 [PATCH 1/2] lib/alchemy: fix rt_mutex_create return values Henning Schild
2017-07-17 14:38 ` [PATCH] meta: dpkg: remove redundant 'addtask' Henning Schild
2017-07-22 22:11   ` Baurzhan Ismagulov
2017-07-17 14:38 ` [PATCH 2/2] lib/alchemy: change API context tags Henning Schild
2017-07-17 14:39   ` Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox