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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Jun 17 10:23:42 2013 +0200

lib/cobalt: cleanup assert error handling

---

 lib/cobalt/assert_context.c |   16 ++++++++--------
 lib/cobalt/init.c           |    5 -----
 lib/cobalt/internal.h       |    6 ++++++
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c
index 7530ff4..45087e7 100644
--- a/lib/cobalt/assert_context.c
+++ b/lib/cobalt/assert_context.c
@@ -19,22 +19,22 @@
 #include <sys/time.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <rtdk.h>
 #include <cobalt/kernel/thread.h>
 #include <asm/xenomai/syscall.h>
 #include <asm-generic/current.h>
-#include <unistd.h>
+#include "internal.h"
 
 static void assert_nrt_inner(void)
 {
-       xnthread_info_t info;
-       int err;
-
-       err = XENOMAI_SYSCALL1(sc_nucleus_current_info, &info);
+       struct xnthread_info info;
+       int ret;
 
-       if (err) {
-               fprintf(stderr, "sc_nucleus_current_info failed: %s, window=%p, 
state=%lx, pid=%d\n",
-                       strerror(-err), xeno_current_window, 
xeno_current_window->state, getpid());
+       ret = XENOMAI_SYSCALL1(sc_nucleus_current_info, &info);
+       if (ret) {
+               report_error("sc_nucleus_current_info failed: %s",
+                       strerror(-ret));
                return;
        }
 
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 537dff8..432439a 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -45,11 +45,6 @@ static pthread_t xeno_main_tid;
 
 void cobalt_clock_init(int);
 
-#define report_error(fmt, args...) \
-       __real_fprintf(stderr, "Xenomai/cobalt: " fmt "\n", ##args)
-#define report_error_cont(fmt, args...) \
-       __real_fprintf(stderr, "                " fmt "\n", ##args)
-
 static void sigill_handler(int sig)
 {
        const char m[] = "Xenomai disabled in kernel?\n";
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index da6f3cc..e83e5a1 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -5,6 +5,12 @@
 #include <pthread.h>
 #include <asm-generic/current.h>
 
+#define report_error(fmt, args...) \
+       __STD(fprintf(stderr, "Xenomai/cobalt: " fmt "\n", ##args))
+
+#define report_error_cont(fmt, args...) \
+       __STD(fprintf(stderr, "                " fmt "\n", ##args))
+
 void xeno_sigshadow_install_once(void);
 
 extern int __cobalt_muxid;


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

Reply via email to