Module: xenomai-head
Branch: master
Commit: 6d543470dd563edb003d4a7352717ed1d5573c69
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=6d543470dd563edb003d4a7352717ed1d5573c69

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Nov  5 22:14:27 2009 +0100

nucleus: wrap find_task_by_pid()

The find_task_by_pid_ns() helper is no more exported starting with
2.6.31. Introduce a conditional implementation for find_task_by_pid()
which does not depend on that helper anymore, when compiling for >=
2.6.31.

---

 include/asm-generic/wrappers.h |   21 +++++++++++++++++++--
 ksrc/nucleus/shadow.c          |    2 +-
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 18af70b..c380dc2 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -480,16 +480,33 @@ unsigned long find_next_bit(const unsigned long *addr,
 #include <linux/semaphore.h>
 #include <linux/pid.h>
 
-#define find_task_by_pid(nr)           \
-  find_task_by_pid_ns(nr, &init_pid_ns)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+
+static inline struct task_struct *wrap_find_task_by_pid(pid_t nr)
+{
+       return pid_task(find_pid_ns(nr, &init_pid_ns), PIDTYPE_PID);
+}
+
+#else /* LINUX_VERSION_CODE < 2.6.31 */
+
+#define wrap_find_task_by_pid(nr)      \
+       find_task_by_pid_ns(nr, &init_pid_ns)
+
+#endif /* LINUX_VERSION_CODE < 2.6.31 */
+
 #define kill_proc(pid, sig, priv)      \
   kill_proc_info(sig, (priv) ? SEND_SIG_PRIV : SEND_SIG_NOINFO, pid)
 
 #else /* LINUX_VERSION_CODE < 2.6.27 */
+
 #include <asm/semaphore.h>
+
 #ifndef CONFIG_MMU
 #define pgprot_noncached(p) (p)
 #endif /* !CONFIG_MMU */
+
+#define wrap_find_task_by_pid(nr)  find_task_by_pid(nr)
+
 #endif /* LINUX_VERSION_CODE < 2.6.27 */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index d6d1203..1eae0a1 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -1687,7 +1687,7 @@ void xnshadow_signal_completion(xncompletion_t __user 
*u_completion, int err)
 
        read_lock(&tasklist_lock);
 
-       p = find_task_by_pid(completion.pid);
+       p = wrap_find_task_by_pid(completion.pid);
 
        if (p)
                wake_up_process(p);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to