Module: xenomai-2.4 Branch: master Commit: 97425f9c43182d6432cc3eb4bff4a849c151fd4e URL: http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=97425f9c43182d6432cc3eb4bff4a849c151fd4e
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 | 19 +++++++++++++++++-- ksrc/nucleus/shadow.c | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h index 7b4b09b..229d007 100644 --- a/include/asm-generic/wrappers.h +++ b/include/asm-generic/wrappers.h @@ -355,18 +355,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 f654d6a..0b02f70 100644 --- a/ksrc/nucleus/shadow.c +++ b/ksrc/nucleus/shadow.c @@ -1749,7 +1749,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