Hi,

when loading latency_rt.ko, e.g., and issueing a "cat /proc/rtai/sched", you get a nice kernel oops (at least with latest CVS).

The reason: xnthread_user_pid(), as used by sched_read_proc and xnpod_fatal_helper(), doesn't work with kernel-only threads. The attached patch avoids this problem.

Jan
Index: include/nucleus/thread.h
===================================================================
RCS file: /cvs/rtai/fusion/include/nucleus/thread.h,v
retrieving revision 1.29
diff -u -p -r1.29 thread.h
--- include/nucleus/thread.h    10 Jul 2005 11:30:40 -0000      1.29
+++ include/nucleus/thread.h    14 Jul 2005 10:50:36 -0000
@@ -202,7 +202,8 @@ typedef struct xnhook {
 #define xnthread_signaled_p(thread)        ((thread)->signals != 0)
 #define xnthread_user_task(thread)         
xnarch_user_task(xnthread_archtcb(thread))
 #define xnthread_user_pid(thread) \
-    (testbits((thread)->status,XNROOT) ? 0 : 
xnarch_user_pid(xnthread_archtcb(thread)))
+    (testbits((thread)->status,XNROOT) || !xnthread_user_task(thread) ? \
+    0 : xnarch_user_pid(xnthread_archtcb(thread)))
 
 #ifdef __cplusplus
 extern "C" {

Reply via email to