[Xenomai-git] Philippe Gerum : nucleus: wrap find_task_by_pid()

2009-11-06 Thread GIT version control
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


[Xenomai-git] Philippe Gerum : nucleus: wrap find_task_by_pid()

2009-11-06 Thread GIT version control
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


[Xenomai-git] Philippe Gerum : doc: fix typo

2009-11-06 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 7f53ab3976dc09b3073dc1dcf75587f87d7bc1da
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=7f53ab3976dc09b3073dc1dcf75587f87d7bc1da

Author: Philippe Gerum r...@xenomai.org
Date:   Thu Nov  5 22:17:40 2009 +0100

doc: fix typo

---

 ksrc/nucleus/pod.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 370ad28..9d6e63d 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -1148,7 +1148,7 @@ void xnpod_delete_thread(xnthread_t *thread)
 * If thread is not current, has the deferred cancelability
 * bit set, and is currently blocked on a synchronization
 * object, then unblock it immediately but defer actual
-* deletion if it became runnable (i.e. XNSUSP/XNHELP might be
+* deletion if it became runnable (i.e. XNSUSP/XNHELD might be
 * set as well). The code responsible for putting that thread
 * to sleep should process the XNCANPND condition on the
 * resumption path, then eventually call xnpod_delete_self()


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


[Xenomai-git] Jan Kiszka : native: Properly update lockcnt on recursive call from secondary mode

2009-11-06 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 8ade06dd81c89f3938294527e86907417291ba94
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=8ade06dd81c89f3938294527e86907417291ba94

Author: Jan Kiszka jan.kis...@siemens.com
Date:   Thu Nov  5 18:28:10 2009 +0100

native: Properly update lockcnt on recursive call from secondary mode

We cannot assume that only non-recursive rt_mutex_acquire calls will
happen; the application may be buggy and come from secondary mode. Make
sure to update the user space recursion counter correctly in any case so
that at least the mutex is kept in a valid state.

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

---

 src/skins/native/mutex.c |   14 ++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/skins/native/mutex.c b/src/skins/native/mutex.c
index 29843c7..98844ef 100644
--- a/src/skins/native/mutex.c
+++ b/src/skins/native/mutex.c
@@ -96,6 +96,20 @@ static int rt_mutex_acquire_inner(RT_MUTEX *mutex, RTIME 
timeout, xntmode_t mode
 
if (timeout == TM_NONBLOCK  mode == XN_RELATIVE)
return -EWOULDBLOCK;
+   } else if (xnsynch_fast_owner_check(mutex-fastlock, cur) == 0) {
+   /*
+* The application is buggy as it jumped to secondary mode
+* while holding the mutex. Nevertheless, we have to keep the
+* mutex state consistent.
+*
+* We make no efforts to migrate or warn here. There is
+* CONFIG_XENO_OPT_DEBUG_SYNCH_RELAX to catch such bugs.
+*/
+   if (mutex-lockcnt == UINT_MAX)
+   return -EAGAIN;
+
+   mutex-lockcnt++;
+   return 0;
}
 #endif /* CONFIG_XENO_FASTSYNCH */
 


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