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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Sep  3 17:09:00 2014 +0200

cobalt/posix/thread, copperplate/threadobj: make thread stat structure 
32/64bit-neutral

---

 include/cobalt/uapi/thread.h    |   14 +++++++-------
 include/copperplate/threadobj.h |   31 ++++++++++++++++---------------
 kernel/cobalt/assert.c          |    2 +-
 kernel/cobalt/posix/thread.c    |    4 +---
 4 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/include/cobalt/uapi/thread.h b/include/cobalt/uapi/thread.h
index 05b601a..714af43 100644
--- a/include/cobalt/uapi/thread.h
+++ b/include/cobalt/uapi/thread.h
@@ -37,15 +37,15 @@ struct cobalt_condattr {
 };
 
 struct cobalt_threadstat {
+       __u64 xtime;
+       __u64 timeout;
+       __u64 msw;
+       __u64 csw;
+       __u64 xsc;
+       __u32 status;
+       __u32 pf;
        int cpu;
        int cprio;
-       unsigned long status;
-       unsigned long long xtime;
-       unsigned long msw;
-       unsigned long csw;
-       unsigned long xsc;
-       unsigned long pf;
-       unsigned long long timeout;
        char name[XNOBJECT_NAME_LEN];
        char personality[XNOBJECT_NAME_LEN];
 };
diff --git a/include/copperplate/threadobj.h b/include/copperplate/threadobj.h
index 3a707e5..05bc642 100644
--- a/include/copperplate/threadobj.h
+++ b/include/copperplate/threadobj.h
@@ -23,6 +23,7 @@
 #include <semaphore.h>
 #include <signal.h>
 #include <pthread.h>
+#include <stdint.h>
 #include <boilerplate/list.h>
 #include <boilerplate/lock.h>
 #include <boilerplate/sched.h>
@@ -42,24 +43,24 @@ struct threadobj_corespec {
 };
 
 struct threadobj_stat {
-       /** Current CPU for thread. */
-       int cpu;
-       /** Scheduler lock nesting count. */
-       int schedlock;
-       /** Cobalt thread status bits. */
-       unsigned long status;
        /** Execution time in primary mode (ns). */
        ticks_t xtime;
+       /** Current timeout value (ns). */
+       ticks_t timeout;
        /** Number of primary->secondary mode switches. */
-       unsigned long msw;
+       uint64_t msw;
        /** Number of context switches. */
-       unsigned long csw;
+       uint64_t csw;
        /** Number of Xenomai syscalls. */
-       unsigned long xsc;
+       uint64_t xsc;
+       /** Current CPU for thread. */
+       int cpu;
+       /** Scheduler lock nesting count. */
+       int schedlock;
+       /** Cobalt thread status bits. */
+       unsigned int status;
        /** Number of page faults. */
-       unsigned long pf;
-       /** Current timeout value (ns). */
-       ticks_t timeout;
+       uint32_t pf;
 };
 
 #define SCHED_CORE  SCHED_COBALT
@@ -88,14 +89,14 @@ struct threadobj_corespec {
 };
 
 struct threadobj_stat {
+       /** Current timeout value (ns). */
+       ticks_t timeout;
        /** Current CPU for thread. */
        int cpu;
        /** Scheduler lock nesting count. */
        int schedlock;
        /** Mercury thread status bits. */
-       unsigned long status;
-       /** Current timeout value (ns). */
-       ticks_t timeout;
+       unsigned int status;
 };
 
 #define SCHED_CORE  SCHED_FIFO
diff --git a/kernel/cobalt/assert.c b/kernel/cobalt/assert.c
index bc0d87e..e9cc06c 100644
--- a/kernel/cobalt/assert.c
+++ b/kernel/cobalt/assert.c
@@ -67,7 +67,7 @@ void __xnsys_fatal(const char *format, ...)
                                continue;
                        cprio = xnthread_current_priority(thread);
                        ksformat(pbuf, sizeof(pbuf), "%3d", cprio);
-                       printk(KERN_ERR "%c%3u  %-6d %-8s %-8Lu %.8lx  %s\n",
+                       printk(KERN_ERR "%c%3u  %-6d %-8s %-8Lu %.8x  %s\n",
                               thread == sched->curr ? '>' : ' ',
                               cpu,
                               xnthread_host_pid(thread),
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 0395670..4c87237 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -760,9 +760,7 @@ COBALT_SYSCALL(thread_getstat, current,
                thread = &p->threadbase;
        }
 
-       /*
-        * We have to hold the nklock to keep most values consistent.
-        */
+       /* We have to hold the nklock to keep most values consistent. */
        stat.cpu = xnsched_cpu(thread->sched);
        stat.cprio = xnthread_current_priority(thread);
        xtime = xnthread_get_exectime(thread);


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

Reply via email to