Module: xenomai-forge
Branch: next
Commit: fc8c45bbf2a1d83b634531f1ebaf33c8462b2ec6
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=fc8c45bbf2a1d83b634531f1ebaf33c8462b2ec6

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed May  7 11:20:28 2014 +0200

copperplate/internal: drop copperplate_probe_node()

copperplate_probe_node() has become redundant, as Cobalt has
introduced a strict real-time replacement for the kill(2)
interface.

Therefore kill(pid, 0) is now available to both cores for probing for
a node.

---

 lib/copperplate/cluster.c  |    8 +++++++-
 lib/copperplate/internal.c |   18 ------------------
 lib/copperplate/internal.h |    2 --
 3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/lib/copperplate/cluster.c b/lib/copperplate/cluster.c
index a36fd30..30d50c1 100644
--- a/lib/copperplate/cluster.c
+++ b/lib/copperplate/cluster.c
@@ -152,7 +152,13 @@ static int cluster_probe(struct hashobj *hobj)
        if (cobj->cnode == __node_id)
                return 1; /* Trivial check: is it ours? */
 
-       return copperplate_probe_node(cobj->cnode);
+       /*
+        * The node identifier is actually the main thread pid, so if
+        * we can send the latter a signal, the node is deemed active.
+        * Over Cobalt, the main thread is always shadowed, therefore
+        * we may use Cobalt's kill() service to probe for it.
+        */
+       return __RT(kill(cobj->cnode, 0));
 }
 
 int cluster_addobj(struct cluster *c, const char *name,
diff --git a/lib/copperplate/internal.c b/lib/copperplate/internal.c
index 16513e9..5513b2c 100644
--- a/lib/copperplate/internal.c
+++ b/lib/copperplate/internal.c
@@ -52,19 +52,6 @@ pid_t copperplate_get_tid(void)
 
 #include "cobalt/internal.h"
 
-int copperplate_probe_node(unsigned int id)
-{
-       /*
-        * XXX: this call does NOT migrate to secondary mode therefore
-        * may be used in time-critical contexts. However, since the
-        * nucleus has to know about a probed thread to find out
-        * whether it exists, copperplate_init() must always be
-        * invoked from a real-time shadow, so that __node_id can be
-        * matched.
-        */
-       return pthread_probe_np((pid_t)id) == 0;
-}
-
 int copperplate_create_thread(struct corethread_attributes *cta,
                              pthread_t *tid)
 {
@@ -127,11 +114,6 @@ int copperplate_kill_tid(pid_t tid, int sig)
 
 #else /* CONFIG_XENO_MERCURY */
 
-int copperplate_probe_node(unsigned int id)
-{
-       return kill((pid_t)id, 0) == 0;
-}
-
 int copperplate_kill_tid(pid_t tid, int sig)
 {
        return syscall(__NR_tkill, tid, sig) ? -errno : 0;
diff --git a/lib/copperplate/internal.h b/lib/copperplate/internal.h
index d195ac0..fa3e5d1 100644
--- a/lib/copperplate/internal.h
+++ b/lib/copperplate/internal.h
@@ -79,8 +79,6 @@ pid_t copperplate_get_tid(void);
 
 int copperplate_kill_tid(pid_t tid, int sig);
 
-int copperplate_probe_node(unsigned int id);
-
 int copperplate_create_thread(struct corethread_attributes *cta,
                              pthread_t *tid);
 


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

Reply via email to