public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Henning Schild <henning.schild@siemens.com>
To: isar-users@googlegroups.com
Cc: Henning Schild <henning.schild@siemens.com>
Subject: [PATCH 1/2] lib/alchemy: fix rt_mutex_create return values
Date: Mon, 17 Jul 2017 16:38:20 +0200	[thread overview]
Message-ID: <20170717143822.11844-1-henning.schild@siemens.com> (raw)

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


             reply	other threads:[~2017-07-17 14:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-17 14:38 Henning Schild [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170717143822.11844-1-henning.schild@siemens.com \
    --to=henning.schild@siemens.com \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox