Module: xenomai-jki
Branch: for-forge
Commit: 26dafedcf95e539450f423f5a1c3e98cf85706a1
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=26dafedcf95e539450f423f5a1c3e98cf85706a1

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Fri Oct 16 16:57:50 2015 +0200

lib/cobalt: Forward kill to Linux if no target was found

If the user targets a task that is not under Xenomai control, retry the
call via Linux as it may be a regular task.

As this changes the semantics also for internal users, adjust
copperplate_probe_tid to use the new RT-safe cobalt_thread_probe
service instead.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 lib/cobalt/signal.c        |    4 ++++
 lib/copperplate/internal.c |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/cobalt/signal.c b/lib/cobalt/signal.c
index aac4059..7e03301 100644
--- a/lib/cobalt/signal.c
+++ b/lib/cobalt/signal.c
@@ -99,6 +99,10 @@ COBALT_IMPL(int, kill, (pid_t pid, int sig))
 
        ret = XENOMAI_SYSCALL2(sc_cobalt_kill, pid, sig);
        if (ret) {
+               /* Retry with regular kill is no RT target was found. */
+               if (ret == -ESRCH)
+                       return __STD(kill(pid, sig));
+
                errno = -ret;
                return -1;
        }
diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index eeb40e1..2549ab0 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -93,7 +93,7 @@ int copperplate_kill_tid(pid_t tid, int sig)
 
 int copperplate_probe_tid(pid_t tid)
 {
-       return copperplate_kill_tid(tid, 0);
+       return cobalt_thread_probe(tid);
 }
 
 void copperplate_set_current_name(const char *name)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to