Module: xenomai-forge
Branch: master
Commit: 12047c2d1eb633ea5b807aec45f6d905b2ab22d4
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=12047c2d1eb633ea5b807aec45f6d905b2ab22d4

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jun 18 09:41:52 2013 +0200

lib/cobalt: fix naming for consistency

xeno_* identifiers, and all extern symbols become cobalt_*.

In addition, hidden global variables are prefixed by a double
underscore.

This change causes the UAPI level to be increased, due to renaming
xeno_sigwinch_handler() to cobalt_sigshadow_handler().

---

 config/apirev                         |    2 +-
 include/cobalt/asm-generic/current.h  |   53 +++++++++++++++++---------------
 include/cobalt/asm-generic/sem_heap.h |    4 +-
 include/cobalt/asm-generic/stack.h    |    4 +-
 include/cobalt/asm-nios2/tsc.h        |    4 +-
 include/cobalt/asm-sh/tsc.h           |   10 +++---
 include/cobalt/semaphore.h            |   12 ++++----
 kernel/cobalt/posix/cond.h            |    4 +-
 kernel/cobalt/posix/mutex.h           |    6 ++--
 kernel/cobalt/posix/sem.c             |    6 ++--
 kernel/cobalt/posix/thread.c          |   41 +++++++++++++------------
 kernel/cobalt/posix/timer.c           |    4 +-
 lib/cobalt/assert_context.c           |    8 ++--
 lib/cobalt/cond.c                     |   32 ++++++++++----------
 lib/cobalt/current.c                  |   52 ++++++++++++++++----------------
 lib/cobalt/init.c                     |   23 +++++++-------
 lib/cobalt/internal.c                 |   20 ++++++------
 lib/cobalt/internal.h                 |    2 +-
 lib/cobalt/mutex.c                    |   30 +++++++++---------
 lib/cobalt/printf.c                   |   38 ++++++++++++------------
 lib/cobalt/sem_heap.c                 |   38 ++++++++++++------------
 lib/cobalt/sem_heap.h                 |    2 +-
 lib/cobalt/semaphore.c                |   24 +++++++-------
 lib/cobalt/sigshadow.c                |   20 ++++++------
 lib/cobalt/sysdeps/nios2/features.c   |    4 +-
 lib/cobalt/sysdeps/sh/features.c      |   10 +++---
 lib/cobalt/thread.c                   |   26 ++++++++--------
 lib/copperplate/threadobj.c           |    4 +-
 testsuite/switchtest/switchtest.c     |    4 +-
 testsuite/unit/check-vdso.c           |    4 +-
 testsuite/unit/cond-torture.c         |    2 +-
 testsuite/unit/mutex-torture.c        |    6 ++--
 32 files changed, 252 insertions(+), 247 deletions(-)

diff --git a/config/apirev b/config/apirev
index d00491f..0cfbf08 100644
--- a/config/apirev
+++ b/config/apirev
@@ -1 +1 @@
-1
+2
diff --git a/include/cobalt/asm-generic/current.h 
b/include/cobalt/asm-generic/current.h
index 3e53b9e..735f232 100644
--- a/include/cobalt/asm-generic/current.h
+++ b/include/cobalt/asm-generic/current.h
@@ -4,73 +4,76 @@
 #include <pthread.h>
 #include <cobalt/kernel/thread.h>
 
-extern pthread_key_t xeno_current_window_key;
+extern pthread_key_t cobalt_current_window_key;
 
-xnhandle_t xeno_slow_get_current(void);
+xnhandle_t cobalt_get_current_slow(void);
 
 #ifdef HAVE_TLS
 extern __thread __attribute__ ((tls_model (CONFIG_XENO_TLS_MODEL)))
-xnhandle_t xeno_current;
+xnhandle_t cobalt_current;
 extern __thread __attribute__ ((tls_model (CONFIG_XENO_TLS_MODEL)))
-struct xnthread_user_window *xeno_current_window;
+struct xnthread_user_window *cobalt_current_window;
 
-static inline xnhandle_t xeno_get_current(void)
+static inline xnhandle_t cobalt_get_current(void)
 {
-       return xeno_current;
+       return cobalt_current;
 }
 
-#define xeno_get_current_fast() xeno_get_current()
+static inline xnhandle_t cobalt_get_current_fast(void)
+{
+       return cobalt_get_current();
+}
 
-static inline unsigned long xeno_get_current_mode(void)
+static inline unsigned long cobalt_get_current_mode(void)
 {
-       return xeno_current_window ? xeno_current_window->state : XNRELAX;
+       return cobalt_current_window ? cobalt_current_window->state : XNRELAX;
 }
 
-static inline struct xnthread_user_window *xeno_get_current_window(void)
+static inline struct xnthread_user_window *cobalt_get_current_window(void)
 {
-       return xeno_current ? xeno_current_window : NULL;
+       return cobalt_current ? cobalt_current_window : NULL;
 }
 
 #else /* ! HAVE_TLS */
-extern pthread_key_t xeno_current_key;
+extern pthread_key_t cobalt_current_key;
 
-xnhandle_t xeno_slow_get_current(void);
+xnhandle_t cobalt_get_current_slow(void);
 
-static inline xnhandle_t xeno_get_current(void)
+static inline xnhandle_t cobalt_get_current(void)
 {
-       void *val = pthread_getspecific(xeno_current_key);
+       void *val = pthread_getspecific(cobalt_current_key);
 
-       return (xnhandle_t)val ?: xeno_slow_get_current();
+       return (xnhandle_t)val ?: cobalt_get_current_slow();
 }
 
 /* syscall-free, but unreliable in TSD destructor context */
-static inline xnhandle_t xeno_get_current_fast(void)
+static inline xnhandle_t cobalt_get_current_fast(void)
 {
-       void *val = pthread_getspecific(xeno_current_key);
+       void *val = pthread_getspecific(cobalt_current_key);
 
        return (xnhandle_t)val ?: XN_NO_HANDLE;
 }
 
-static inline unsigned long xeno_get_current_mode(void)
+static inline unsigned long cobalt_get_current_mode(void)
 {
        struct xnthread_user_window *window;
 
-       window = pthread_getspecific(xeno_current_window_key);
+       window = pthread_getspecific(cobalt_current_window_key);
 
        return window ? window->state : XNRELAX;
 }
 
-static inline struct xnthread_user_window *xeno_get_current_window(void)
+static inline struct xnthread_user_window *cobalt_get_current_window(void)
 {
-       return pthread_getspecific(xeno_current_window_key);
+       return pthread_getspecific(cobalt_current_window_key);
 }
 
 #endif /* ! HAVE_TLS */
 
-void xeno_init_current_keys(void);
+void cobalt_init_current_keys(void);
 
-void xeno_set_current(void);
+void cobalt_set_current(void);
 
-void xeno_set_current_window(unsigned long offset);
+void cobalt_set_current_window(unsigned long offset);
 
 #endif /* _COBALT_ASM_GENERIC_CURRENT_H */
diff --git a/include/cobalt/asm-generic/sem_heap.h 
b/include/cobalt/asm-generic/sem_heap.h
index 6ce3dcb..c491f2b 100644
--- a/include/cobalt/asm-generic/sem_heap.h
+++ b/include/cobalt/asm-generic/sem_heap.h
@@ -3,8 +3,8 @@
 
 #include <cobalt/kernel/heap.h>
 
-void xeno_init_sem_heaps(void);
+void cobalt_init_sem_heaps(void);
 
-void *xeno_map_heap(struct xnheap_desc *hd);
+void *cobalt_map_heap(struct xnheap_desc *hd);
 
 #endif /* XENO_SEM_HEAP_H */
diff --git a/include/cobalt/asm-generic/stack.h 
b/include/cobalt/asm-generic/stack.h
index fe8ae1b..f863df6 100644
--- a/include/cobalt/asm-generic/stack.h
+++ b/include/cobalt/asm-generic/stack.h
@@ -10,7 +10,7 @@
 extern "C" {
 #endif /* __cplusplus */
 
-static inline unsigned xeno_stacksize(unsigned size)
+static inline unsigned cobalt_get_stacksize(unsigned size)
 {
        static const unsigned default_size = __WORDSIZE * 1024;
        static unsigned min_size;
@@ -25,7 +25,7 @@ static inline unsigned xeno_stacksize(unsigned size)
        return size;
 }
 
-void xeno_fault_stack(void);
+void cobalt_prefault_stack(void);
 
 #ifdef __cplusplus
 }
diff --git a/include/cobalt/asm-nios2/tsc.h b/include/cobalt/asm-nios2/tsc.h
index 6c21457..c8317e6 100644
--- a/include/cobalt/asm-nios2/tsc.h
+++ b/include/cobalt/asm-nios2/tsc.h
@@ -22,14 +22,14 @@
 
 #ifndef __KERNEL__
 
-extern volatile void *xeno_nios2_hrclock;
+extern volatile void *__cobalt_nios2_hrclock;
 
 static inline unsigned long long __xn_rdtsc(void)
 {
        volatile unsigned short *hrclock;
        int64_t t0, t1;
 
-       hrclock = xeno_nios2_hrclock;
+       hrclock = __cobalt_nios2_hrclock;
 
 #define hrclock_wrsnap(reg, val)               \
        (*(hrclock + (12 + ((reg) * 2)))) = (val)
diff --git a/include/cobalt/asm-sh/tsc.h b/include/cobalt/asm-sh/tsc.h
index ad0ec70..e46e0f0 100644
--- a/include/cobalt/asm-sh/tsc.h
+++ b/include/cobalt/asm-sh/tsc.h
@@ -37,18 +37,18 @@ struct xnarch_tsc_area {
        unsigned long counter_pa;
 };
 
-extern volatile struct xnarch_tsc_area *xeno_sh_tsc;
+extern volatile struct xnarch_tsc_area *__cobalt_sh_tsc;
 
-extern volatile unsigned long *xeno_sh_tcnt;
+extern volatile unsigned long *__cobalt_sh_tcnt;
 
 static inline unsigned long long __xn_rdtsc(void)
 {
        unsigned long long tsc;
        unsigned long low;
 
-       tsc = xeno_sh_tsc->tsc.high;
-       low = *xeno_sh_tcnt ^ 0xffffffffUL;
-       if (low < xeno_sh_tsc->tsc.low)
+       tsc = __cobalt_sh_tsc->tsc.high;
+       low = *__cobalt_sh_tcnt ^ 0xffffffffUL;
+       if (low < __cobalt_sh_tsc->tsc.low)
                tsc++;
        tsc = (tsc << 32)|low;
 
diff --git a/include/cobalt/semaphore.h b/include/cobalt/semaphore.h
index 1530b08..9a3ba11 100644
--- a/include/cobalt/semaphore.h
+++ b/include/cobalt/semaphore.h
@@ -88,12 +88,12 @@ int sem_broadcast_np(sem_t *sem);
 
 struct cobalt_sem;
 
-union __xeno_sem {
-    sem_t native_sem;
-    struct __shadow_sem {
-       unsigned magic;
-       struct cobalt_sem *sem;
-    } shadow_sem;
+union cobalt_sem_union {
+       sem_t native_sem;
+       struct __shadow_sem {
+               unsigned int magic;
+               struct cobalt_sem *sem;
+       } shadow_sem;
 };
 
 /* For Cobalt's sem_init_np() extension. */
diff --git a/kernel/cobalt/posix/cond.h b/kernel/cobalt/posix/cond.h
index a3250db..243fb04 100644
--- a/kernel/cobalt/posix/cond.h
+++ b/kernel/cobalt/posix/cond.h
@@ -24,7 +24,7 @@
 struct cobalt_cond;
 struct mutex_dat;
 
-union __xeno_cond {
+union cobalt_cond_union {
        pthread_cond_t native_cond;
        struct __shadow_cond {
                unsigned magic;
@@ -48,7 +48,7 @@ union __xeno_cond {
 #include "internal.h"
 
 struct __shadow_mutex;
-union __xeno_mutex;
+union cobalt_mutex_union;
 
 typedef struct cobalt_cond {
        unsigned magic;
diff --git a/kernel/cobalt/posix/mutex.h b/kernel/cobalt/posix/mutex.h
index 0df4a84..e9d971f 100644
--- a/kernel/cobalt/posix/mutex.h
+++ b/kernel/cobalt/posix/mutex.h
@@ -32,7 +32,7 @@ struct mutex_dat {
 #define COBALT_MUTEX_ERRORCHECK  0x00000002
 };
 
-union __xeno_mutex {
+union cobalt_mutex_union {
        pthread_mutex_t native_mutex;
        struct __shadow_mutex {
                unsigned magic;
@@ -170,12 +170,12 @@ void cobalt_mutex_pkg_cleanup(void);
 
 #else /* ! __KERNEL__ */
 
-extern unsigned long xeno_sem_heap[2];
+extern unsigned long cobalt_sem_heap[2];
 
 static inline struct mutex_dat *mutex_get_datp(struct __shadow_mutex *shadow)
 {
        if (shadow->attr.pshared)
-               return (struct mutex_dat *)(xeno_sem_heap[1] + 
shadow->dat_offset);
+               return (struct mutex_dat *)(cobalt_sem_heap[1] + 
shadow->dat_offset);
 
        return shadow->dat;
 }
diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
index 8c95a01..616e102 100644
--- a/kernel/cobalt/posix/sem.c
+++ b/kernel/cobalt/posix/sem.c
@@ -60,7 +60,7 @@ static inline struct cobalt_kqueues *sem_kqueue(struct 
cobalt_sem *sem)
 typedef struct cobalt_named_sem {
        cobalt_sem_t sembase;   /* Has to be the first member. */
        cobalt_node_t nodebase;
-       union __xeno_sem descriptor;
+       union cobalt_sem_union descriptor;
 } nsem_t;
 
 #define sem2named_sem(saddr) ((nsem_t *)(saddr))
@@ -886,9 +886,9 @@ int cobalt_sem_open(unsigned long __user *u_addr,
                return -EINVAL;
 
        if (!(oflags & O_CREAT))
-               sm = &((union __xeno_sem *)sem_open(name, oflags))->shadow_sem;
+               sm = &((union cobalt_sem_union *)sem_open(name, 
oflags))->shadow_sem;
        else
-               sm = &((union __xeno_sem *)sem_open(name, oflags, mode, 
value))->shadow_sem;
+               sm = &((union cobalt_sem_union *)sem_open(name, oflags, mode, 
value))->shadow_sem;
 
        if (IS_ERR(sm))
                return PTR_ERR(sm);
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 11f75da..f7b30fb 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -327,17 +327,17 @@ unlock_and_exit:
  *
  * If, however, you install a signal handler for SIGWINCH after
  * creating or shadowing the first Xenomai thread, you have to
- * explicitly call the function xeno_sigwinch_handler at the beginning
+ * explicitly call the function cobalt_sigshadow_handler at the beginning
  * of your signal handler, using its return to know if the signal was
  * in fact an internal signal of Xenomai (in which case it returns 1),
  * or if you should handle the signal (in which case it returns
- * 0). xeno_sigwinch_handler prototype is:
+ * 0). cobalt_sigshadow_handler prototype is:
  *
- * <b>int xeno_sigwinch_handler(int sig, siginfo_t *si, void *ctxt);</b>
+ * <b>int cobalt_sigshadow_handler(int sig, siginfo_t *si, void *ctxt);</b>
  *
  * Which means that you should register your handler with sigaction,
  * using the SA_SIGINFO flag, and pass all the arguments you received
- * to xeno_sigwinch_handler.
+ * to cobalt_sigshadow_handler.
  */
 static inline int pthread_create(pthread_t *tid, const pthread_attr_t *attr)
 {
@@ -632,22 +632,23 @@ static inline int pthread_set_mode_np(int clrmask, int 
setmask, int *mode_r)
  * @note
  *
  * When creating or shadowing a Xenomai thread for the first time in
- * user-space, Xenomai installs a handler for the SIGWINCH signal. If you had
- * installed a handler before that, it will be automatically called by Xenomai
- * for SIGWINCH signals that it has not sent.
- *
- * If, however, you install a signal handler for SIGWINCH after creating
- * or shadowing the first Xenomai thread, you have to explicitly call the
- * function xeno_sigwinch_handler at the beginning of your signal handler,
- * using its return to know if the signal was in fact an internal signal of
- * Xenomai (in which case it returns 1), or if you should handle the signal (in
- * which case it returns 0). xeno_sigwinch_handler prototype is:
- *
- * <b>int xeno_sigwinch_handler(int sig, siginfo_t *si, void *ctxt);</b>
- *
- * Which means that you should register your handler with sigaction, using the
- * SA_SIGINFO flag, and pass all the arguments you received to
- * xeno_sigwinch_handler.
+ * user-space, Xenomai installs a handler for the SIGWINCH signal. If
+ * you had installed a handler before that, it will be automatically
+ * called by Xenomai for SIGWINCH signals that it has not sent.
+ *
+ * If, however, you install a signal handler for SIGWINCH after
+ * creating or shadowing the first Xenomai thread, you have to
+ * explicitly call the function cobalt_sigshadow_handler at the
+ * beginning of your signal handler, using its return to know if the
+ * signal was in fact an internal signal of Xenomai (in which case it
+ * returns 1), or if you should handle the signal (in which case it
+ * returns 0). cobalt_sigshadow_handler prototype is:
+ *
+ * <b>int cobalt_sigshadow_handler(int sig, siginfo_t *si, void *ctxt);</b>
+ *
+ * Which means that you should register your handler with sigaction,
+ * using the SA_SIGINFO flag, and pass all the arguments you received
+ * to cobalt_sigshadow_handler.
  *
  * pthread_setschedparam_ex() may switch the caller to secondary mode.
  */
diff --git a/kernel/cobalt/posix/timer.c b/kernel/cobalt/posix/timer.c
index 224eda3..9b66e86 100644
--- a/kernel/cobalt/posix/timer.c
+++ b/kernel/cobalt/posix/timer.c
@@ -146,7 +146,7 @@ static inline int timer_create(clockid_t clockid,
                sem = evp->sigev_value.sival_ptr;
                if (sem == NULL)
                        goto error;
-               shadow_sem = &((union __xeno_sem *)sem)->shadow_sem;
+               shadow_sem = &((union cobalt_sem_union *)sem)->shadow_sem;
                err = sem_getvalue(shadow_sem->sem, &semval);
                if (err)
                        goto error;
@@ -463,7 +463,7 @@ int cobalt_timer_create(clockid_t clock,
                        const struct sigevent __user *u_sev,
                        timer_t __user *u_tm)
 {
-       union __xeno_sem sm, __user *u_sem;
+       union cobalt_sem_union sm, __user *u_sem;
        struct sigevent sev, *evp = &sev;
        timer_t tm = 0;
        int ret;
diff --git a/lib/cobalt/assert_context.c b/lib/cobalt/assert_context.c
index 45087e7..0bf9aa3 100644
--- a/lib/cobalt/assert_context.c
+++ b/lib/cobalt/assert_context.c
@@ -44,8 +44,8 @@ static void assert_nrt_inner(void)
 
 void assert_nrt(void)
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                assert_nrt_inner();
 }
 
@@ -56,8 +56,8 @@ void assert_nrt(void)
  */
 void assert_nrt_fast(void)
 {
-       if (xeno_get_current_fast() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current_fast() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                assert_nrt_inner();
 }
 
diff --git a/lib/cobalt/cond.c b/lib/cobalt/cond.c
index 4d3ed27..eb7a6bb 100644
--- a/lib/cobalt/cond.c
+++ b/lib/cobalt/cond.c
@@ -24,12 +24,12 @@
 #include "kernel/cobalt/posix/cond.h"
 #include "internal.h"
 
-extern unsigned long xeno_sem_heap[2];
+extern unsigned long cobalt_sem_heap[2];
 
 static inline unsigned long *cond_get_signalsp(struct __shadow_cond *shadow)
 {
        if (shadow->attr.pshared)
-               return (unsigned long *)(xeno_sem_heap[1]
+               return (unsigned long *)(cobalt_sem_heap[1]
                                         + shadow->pending_signals_offset);
 
        return shadow->pending_signals;
@@ -42,7 +42,7 @@ cond_get_mutex_datp(struct __shadow_cond *shadow)
                return NULL;
 
        if (shadow->attr.pshared)
-               return (struct mutex_dat *)(xeno_sem_heap[1]
+               return (struct mutex_dat *)(cobalt_sem_heap[1]
                                            + shadow->mutex_datp_offset);
 
        return shadow->mutex_datp;
@@ -88,14 +88,14 @@ COBALT_IMPL(int, pthread_condattr_setpshared, 
(pthread_condattr_t *attr, int psh
 COBALT_IMPL(int, pthread_cond_init, (pthread_cond_t *cond,
                                     const pthread_condattr_t * attr))
 {
-       struct __shadow_cond *_cnd = &((union __xeno_cond *)cond)->shadow_cond;
+       struct __shadow_cond *_cnd = &((union cobalt_cond_union 
*)cond)->shadow_cond;
        unsigned long *pending_signalsp;
        int err;
 
        err = XENOMAI_SKINCALL2(__cobalt_muxid, sc_cobalt_cond_init, _cnd, 
attr);
        if (!err && !_cnd->attr.pshared) {
                pending_signalsp = (unsigned long *)
-                       (xeno_sem_heap[0] + _cnd->pending_signals_offset);
+                       (cobalt_sem_heap[0] + _cnd->pending_signals_offset);
                _cnd->pending_signals = pending_signalsp;
        } else
                pending_signalsp = cond_get_signalsp(_cnd);
@@ -107,7 +107,7 @@ COBALT_IMPL(int, pthread_cond_init, (pthread_cond_t *cond,
 
 COBALT_IMPL(int, pthread_cond_destroy, (pthread_cond_t *cond))
 {
-       struct __shadow_cond *_cond = &((union __xeno_cond *)cond)->shadow_cond;
+       struct __shadow_cond *_cond = &((union cobalt_cond_union 
*)cond)->shadow_cond;
 
        return -XENOMAI_SKINCALL1(__cobalt_muxid, sc_cobalt_cond_destroy, 
_cond);
 }
@@ -135,9 +135,9 @@ static void __pthread_cond_cleanup(void *data)
 
 COBALT_IMPL(int, pthread_cond_wait, (pthread_cond_t *cond, pthread_mutex_t 
*mutex))
 {
-       struct __shadow_cond *_cnd = &((union __xeno_cond *)cond)->shadow_cond;
+       struct __shadow_cond *_cnd = &((union cobalt_cond_union 
*)cond)->shadow_cond;
        struct __shadow_mutex *_mx =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        struct cobalt_cond_cleanup_t c = {
                .cond = _cnd,
                .mutex = _mx,
@@ -151,7 +151,7 @@ COBALT_IMPL(int, pthread_cond_wait, (pthread_cond_t *cond, 
pthread_mutex_t *mute
                return EINVAL;
 
        if (_mx->attr.type == PTHREAD_MUTEX_ERRORCHECK) {
-               xnhandle_t cur = xeno_get_current();
+               xnhandle_t cur = cobalt_get_current();
 
                if (cur == XN_NO_HANDLE)
                        return EPERM;
@@ -189,9 +189,9 @@ COBALT_IMPL(int, pthread_cond_timedwait, (pthread_cond_t 
*cond,
                                          pthread_mutex_t *mutex,
                                          const struct timespec *abstime))
 {
-       struct __shadow_cond *_cnd = &((union __xeno_cond *)cond)->shadow_cond;
+       struct __shadow_cond *_cnd = &((union cobalt_cond_union 
*)cond)->shadow_cond;
        struct __shadow_mutex *_mx =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        struct cobalt_cond_cleanup_t c = {
                .cond = _cnd,
                .mutex = _mx,
@@ -204,7 +204,7 @@ COBALT_IMPL(int, pthread_cond_timedwait, (pthread_cond_t 
*cond,
                return EINVAL;
 
        if (_mx->attr.type == PTHREAD_MUTEX_ERRORCHECK) {
-               xnhandle_t cur = xeno_get_current();
+               xnhandle_t cur = cobalt_get_current();
 
                if (cur == XN_NO_HANDLE)
                        return EPERM;
@@ -239,7 +239,7 @@ COBALT_IMPL(int, pthread_cond_timedwait, (pthread_cond_t 
*cond,
 
 COBALT_IMPL(int, pthread_cond_signal, (pthread_cond_t *cond))
 {
-       struct __shadow_cond *_cnd = &((union __xeno_cond *)cond)->shadow_cond;
+       struct __shadow_cond *_cnd = &((union cobalt_cond_union 
*)cond)->shadow_cond;
        unsigned long pending_signals, *pending_signalsp;
        struct mutex_dat *mutex_datp;
        unsigned long flags;
@@ -252,7 +252,7 @@ COBALT_IMPL(int, pthread_cond_signal, (pthread_cond_t 
*cond))
        if (mutex_datp) {
                flags = mutex_datp->flags;
                if (flags & COBALT_MUTEX_ERRORCHECK) {
-                       cur = xeno_get_current();
+                       cur = cobalt_get_current();
                        if (cur == XN_NO_HANDLE)
                                return EPERM;
 
@@ -271,7 +271,7 @@ COBALT_IMPL(int, pthread_cond_signal, (pthread_cond_t 
*cond))
 
 COBALT_IMPL(int, pthread_cond_broadcast, (pthread_cond_t *cond))
 {
-       struct __shadow_cond *_cnd = &((union __xeno_cond *)cond)->shadow_cond;
+       struct __shadow_cond *_cnd = &((union cobalt_cond_union 
*)cond)->shadow_cond;
        struct mutex_dat *mutex_datp;
        unsigned long flags;
        xnhandle_t cur;
@@ -283,7 +283,7 @@ COBALT_IMPL(int, pthread_cond_broadcast, (pthread_cond_t 
*cond))
        if (mutex_datp) {
                flags = mutex_datp->flags ;
                if (flags & COBALT_MUTEX_ERRORCHECK) {
-                       cur = xeno_get_current();
+                       cur = cobalt_get_current();
                        if (cur == XN_NO_HANDLE)
                                return EPERM;
 
diff --git a/lib/cobalt/current.c b/lib/cobalt/current.c
index d425313..f0e6ae8 100644
--- a/lib/cobalt/current.c
+++ b/lib/cobalt/current.c
@@ -10,21 +10,21 @@
 #include <asm-generic/current.h>
 #include "internal.h"
 
-extern unsigned long xeno_sem_heap[2];
+extern unsigned long cobalt_sem_heap[2];
 
 static void child_fork_handler(void);
 
 #ifdef HAVE_TLS
 
 __thread __attribute__ ((tls_model (CONFIG_XENO_TLS_MODEL)))
-xnhandle_t xeno_current = XN_NO_HANDLE;
+xnhandle_t cobalt_current = XN_NO_HANDLE;
 
 __thread __attribute__ ((tls_model (CONFIG_XENO_TLS_MODEL)))
-struct xnthread_user_window *xeno_current_window;
+struct xnthread_user_window *cobalt_current_window;
 
-static inline void __xeno_set_current(xnhandle_t current)
+static inline void __cobalt_set_current(xnhandle_t current)
 {
-       xeno_current = current;
+       cobalt_current = current;
 }
 
 static void init_current_keys(void)
@@ -32,33 +32,33 @@ static void init_current_keys(void)
        pthread_atfork(NULL, NULL, &child_fork_handler);
 }
 
-void xeno_set_current_window(unsigned long offset)
+void cobalt_set_current_window(unsigned long offset)
 {
-       xeno_current_window = (struct xnthread_user_window *)
-               (xeno_sem_heap[0] + offset);
-       __cobalt_prefault(xeno_current_window);
+       cobalt_current_window = (struct xnthread_user_window *)
+               (cobalt_sem_heap[0] + offset);
+       __cobalt_prefault(cobalt_current_window);
 }
 
 #else /* !HAVE_TLS */
 
-pthread_key_t xeno_current_window_key;
-pthread_key_t xeno_current_key;
+pthread_key_t cobalt_current_window_key;
+pthread_key_t cobalt_current_key;
 
-static inline void __xeno_set_current(xnhandle_t current)
+static inline void __cobalt_set_current(xnhandle_t current)
 {
        current = (current != XN_NO_HANDLE ? current : (xnhandle_t)(0));
-       pthread_setspecific(xeno_current_key, (void *)current);
+       pthread_setspecific(cobalt_current_key, (void *)current);
 }
 
 static void init_current_keys(void)
 {
-       int err = pthread_key_create(&xeno_current_key, NULL);
+       int err = pthread_key_create(&cobalt_current_key, NULL);
        if (err)
                goto error_exit;
 
        pthread_atfork(NULL, NULL, &child_fork_handler);
 
-       err = pthread_key_create(&xeno_current_window_key, NULL);
+       err = pthread_key_create(&cobalt_current_window_key, NULL);
        if (err) {
          error_exit:
                fprintf(stderr, "Xenomai: error creating TSD key: %s\n",
@@ -67,12 +67,12 @@ static void init_current_keys(void)
        }
 }
 
-void xeno_set_current_window(unsigned long offset)
+void cobalt_set_current_window(unsigned long offset)
 {
        struct xnthread_user_window *window;
 
-       window = (void *)(xeno_sem_heap[0] + offset);
-       pthread_setspecific(xeno_current_window_key, window);
+       window = (void *)(cobalt_sem_heap[0] + offset);
+       pthread_setspecific(cobalt_current_window_key, window);
        __cobalt_prefault(window);
 }
 
@@ -80,11 +80,11 @@ void xeno_set_current_window(unsigned long offset)
 
 static void child_fork_handler(void)
 {
-       if (xeno_get_current() != XN_NO_HANDLE)
-               __xeno_set_current(XN_NO_HANDLE);
+       if (cobalt_get_current() != XN_NO_HANDLE)
+               __cobalt_set_current(XN_NO_HANDLE);
 }
 
-xnhandle_t xeno_slow_get_current(void)
+xnhandle_t cobalt_get_current_slow(void)
 {
        xnhandle_t current;
        int err;
@@ -94,7 +94,7 @@ xnhandle_t xeno_slow_get_current(void)
        return err ? XN_NO_HANDLE : current;
 }
 
-void xeno_set_current(void)
+void cobalt_set_current(void)
 {
        xnhandle_t current;
        int err;
@@ -105,11 +105,11 @@ void xeno_set_current(void)
                        "thread: %s\n", strerror(-err));
                exit(EXIT_FAILURE);
        }
-       __xeno_set_current(current);
+       __cobalt_set_current(current);
 }
 
-void xeno_init_current_keys(void)
+void cobalt_init_current_keys(void)
 {
-       static pthread_once_t xeno_init_current_keys_once = PTHREAD_ONCE_INIT;
-       pthread_once(&xeno_init_current_keys_once, init_current_keys);
+       static pthread_once_t cobalt_init_current_keys_once = PTHREAD_ONCE_INIT;
+       pthread_once(&cobalt_init_current_keys_once, init_current_keys);
 }
diff --git a/lib/cobalt/init.c b/lib/cobalt/init.c
index 432439a..baa2afa 100644
--- a/lib/cobalt/init.c
+++ b/lib/cobalt/init.c
@@ -37,13 +37,16 @@
 #include "internal.h"
 
 int __cobalt_muxid = -1;
+
+struct sigaction __cobalt_orig_sigdebug;
+
 int __rtdm_muxid = -1;
+
 int __rtdm_fd_start = INT_MAX;
-struct sigaction __cobalt_orig_sigdebug;
+
 static int fork_handler_registered;
-static pthread_t xeno_main_tid;
 
-void cobalt_clock_init(int);
+static pthread_t main_tid;
 
 static void sigill_handler(int sig)
 {
@@ -52,10 +55,10 @@ static void sigill_handler(int sig)
        exit(EXIT_FAILURE);
 }
 
-void xeno_fault_stack(void)
+void cobalt_prefault_stack(void)
 {
-       if (pthread_self() == xeno_main_tid) {
-               char stk[xeno_stacksize(1)];
+       if (pthread_self() == main_tid) {
+               char stk[cobalt_get_stacksize(1)];
                stk[0] = stk[sizeof(stk) - 1] = 0xA5;
        }
 }
@@ -119,11 +122,11 @@ static int bind_interface(void)
                exit(EXIT_FAILURE);
        }
 
-       xeno_init_sem_heaps();
+       cobalt_init_sem_heaps();
 
-       xeno_init_current_keys();
+       cobalt_init_current_keys();
 
-       xeno_main_tid = pthread_self();
+       main_tid = pthread_self();
 
        xnarch_init_timeconv(sysinfo.clockfreq);
 
@@ -158,8 +161,6 @@ void __init_cobalt_interface(void)
        sa.sa_flags = SA_SIGINFO;
        sigaction(SIGXCPU, &sa, &__cobalt_orig_sigdebug);
 
-       cobalt_clock_init(muxid);
-
        __cobalt_muxid = __xn_mux_shifted_id(muxid);
 
        breq.feat_req = XENOMAI_FEAT_DEP;
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index e1ae2c8..12863d6 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -36,13 +36,13 @@
 #include "kernel/cobalt/posix/event.h"
 #include "internal.h"
 
-extern unsigned long xeno_sem_heap[2];
+extern unsigned long cobalt_sem_heap[2];
 
 extern struct sigaction __cobalt_orig_sigdebug;
 
 void __cobalt_thread_harden(void)
 {
-       unsigned long status = xeno_get_current_mode();
+       unsigned long status = cobalt_get_current_mode();
 
        /* non-RT shadows are NOT allowed to force primary mode. */
        if ((status & (XNRELAX|XNWEAK)) == XNRELAX)
@@ -71,7 +71,7 @@ static inline
 struct cobalt_monitor_data *get_monitor_data(cobalt_monitor_t *mon)
 {
        return mon->flags & COBALT_MONITOR_SHARED ?
-               (void *)xeno_sem_heap[1] + mon->u.data_offset :
+               (void *)cobalt_sem_heap[1] + mon->u.data_offset :
                mon->u.data;
 }
 
@@ -87,7 +87,7 @@ int cobalt_monitor_init(cobalt_monitor_t *mon, int flags)
                return ret;
 
        if ((flags & COBALT_MONITOR_SHARED) == 0) {
-               datp = (void *)xeno_sem_heap[0] + mon->u.data_offset;
+               datp = (void *)cobalt_sem_heap[0] + mon->u.data_offset;
                mon->u.data = datp;
        } else
                datp = get_monitor_data(mon);
@@ -118,12 +118,12 @@ int cobalt_monitor_enter(cobalt_monitor_t *mon)
         * - no recursive entry/locking.
         */
 
-       status = xeno_get_current_mode();
+       status = cobalt_get_current_mode();
        if (status & (XNRELAX|XNWEAK))
                goto syscall;
 
        datp = get_monitor_data(mon);
-       cur = xeno_get_current();
+       cur = cobalt_get_current();
        ret = xnsynch_fast_acquire(&datp->owner, cur);
        if (ret == 0) {
                datp->flags &= 
~(COBALT_MONITOR_SIGNALED|COBALT_MONITOR_BROADCAST);
@@ -156,11 +156,11 @@ int cobalt_monitor_exit(cobalt_monitor_t *mon)
            (datp->flags & COBALT_MONITOR_SIGNALED))
                goto syscall;
 
-       status = xeno_get_current_mode();
+       status = cobalt_get_current_mode();
        if (status & XNWEAK)
                goto syscall;
 
-       cur = xeno_get_current();
+       cur = cobalt_get_current();
        if (xnsynch_fast_release(&datp->owner, cur))
                return 0;
 syscall:
@@ -343,7 +343,7 @@ static inline
 struct cobalt_event_data *get_event_data(cobalt_event_t *event)
 {
        return event->flags & COBALT_EVENT_SHARED ?
-               (void *)xeno_sem_heap[1] + event->u.data_offset :
+               (void *)cobalt_sem_heap[1] + event->u.data_offset :
                event->u.data;
 }
 
@@ -360,7 +360,7 @@ int cobalt_event_init(cobalt_event_t *event, unsigned long 
value,
                return ret;
 
        if ((flags & COBALT_EVENT_SHARED) == 0) {
-               datp = (void *)xeno_sem_heap[0] + event->u.data_offset;
+               datp = (void *)cobalt_sem_heap[0] + event->u.data_offset;
                event->u.data = datp;
        } else
                datp = get_event_data(event);
diff --git a/lib/cobalt/internal.h b/lib/cobalt/internal.h
index e83e5a1..93d2b2d 100644
--- a/lib/cobalt/internal.h
+++ b/lib/cobalt/internal.h
@@ -11,7 +11,7 @@
 #define report_error_cont(fmt, args...) \
        __STD(fprintf(stderr, "                " fmt "\n", ##args))
 
-void xeno_sigshadow_install_once(void);
+void cobalt_sigshadow_install_once(void);
 
 extern int __cobalt_muxid;
 
diff --git a/lib/cobalt/mutex.c b/lib/cobalt/mutex.c
index 4ee3d21..aa774fc 100644
--- a/lib/cobalt/mutex.c
+++ b/lib/cobalt/mutex.c
@@ -80,7 +80,7 @@ COBALT_IMPL(int, pthread_mutex_init, (pthread_mutex_t *mutex,
                                      const pthread_mutexattr_t *attr))
 {
        struct __shadow_mutex *_mutex =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        struct mutex_dat *datp;
        int err;
 
@@ -96,7 +96,7 @@ COBALT_IMPL(int, pthread_mutex_init, (pthread_mutex_t *mutex,
 
        if (!_mutex->attr.pshared) {
                datp = (struct mutex_dat *)
-                       (xeno_sem_heap[0] + _mutex->dat_offset);
+                       (cobalt_sem_heap[0] + _mutex->dat_offset);
                _mutex->dat = datp;
        } else
                datp = mutex_get_datp(_mutex);
@@ -109,7 +109,7 @@ COBALT_IMPL(int, pthread_mutex_init, (pthread_mutex_t 
*mutex,
 COBALT_IMPL(int, pthread_mutex_destroy, (pthread_mutex_t *mutex))
 {
        struct __shadow_mutex *_mutex =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        int err;
 
        if (_mutex->magic != COBALT_MUTEX_MAGIC)
@@ -123,12 +123,12 @@ COBALT_IMPL(int, pthread_mutex_destroy, (pthread_mutex_t 
*mutex))
 COBALT_IMPL(int, pthread_mutex_lock, (pthread_mutex_t *mutex))
 {
        struct __shadow_mutex *_mutex =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        unsigned long status;
        xnhandle_t cur;
        int err;
 
-       cur = xeno_get_current();
+       cur = cobalt_get_current();
        if (cur == XN_NO_HANDLE)
                return EPERM;
 
@@ -140,7 +140,7 @@ COBALT_IMPL(int, pthread_mutex_lock, (pthread_mutex_t 
*mutex))
         * order to handle the auto-relax feature, so we must always
         * obtain them via a syscall.
         */
-       status = xeno_get_current_mode();
+       status = cobalt_get_current_mode();
        if ((status & (XNRELAX|XNWEAK)) == 0) {
                err = xnsynch_fast_acquire(mutex_get_ownerp(_mutex), cur);
                if (err == 0) {
@@ -182,12 +182,12 @@ COBALT_IMPL(int, pthread_mutex_timedlock, 
(pthread_mutex_t *mutex,
                                           const struct timespec *to))
 {
        struct __shadow_mutex *_mutex =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        unsigned long status;
        xnhandle_t cur;
        int err;
 
-       cur = xeno_get_current();
+       cur = cobalt_get_current();
        if (cur == XN_NO_HANDLE)
                return EPERM;
 
@@ -195,7 +195,7 @@ COBALT_IMPL(int, pthread_mutex_timedlock, (pthread_mutex_t 
*mutex,
                return EINVAL;
 
        /* See __wrap_pthread_mutex_lock() */
-       status = xeno_get_current_mode();
+       status = cobalt_get_current_mode();
        if ((status & (XNRELAX|XNWEAK)) == 0) {
                err = xnsynch_fast_acquire(mutex_get_ownerp(_mutex), cur);
                if (err == 0) {
@@ -237,19 +237,19 @@ COBALT_IMPL(int, pthread_mutex_timedlock, 
(pthread_mutex_t *mutex,
 COBALT_IMPL(int, pthread_mutex_trylock, (pthread_mutex_t *mutex))
 {
        struct __shadow_mutex *_mutex =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        unsigned long status;
        xnhandle_t cur;
        int err;
 
-       cur = xeno_get_current();
+       cur = cobalt_get_current();
        if (cur == XN_NO_HANDLE)
                return EPERM;
 
        if (_mutex->magic != COBALT_MUTEX_MAGIC)
                return EINVAL;
 
-       status = xeno_get_current_mode();
+       status = cobalt_get_current_mode();
        if ((status & (XNRELAX|XNWEAK)) == 0) {
                err = xnsynch_fast_acquire(mutex_get_ownerp(_mutex), cur);
                if (err == 0) {
@@ -290,7 +290,7 @@ do_syscall:
 COBALT_IMPL(int, pthread_mutex_unlock, (pthread_mutex_t *mutex))
 {
        struct __shadow_mutex *_mutex =
-               &((union __xeno_mutex *)mutex)->shadow_mutex;
+               &((union cobalt_mutex_union *)mutex)->shadow_mutex;
        struct mutex_dat *datp = NULL;
        xnhandle_t cur = XN_NO_HANDLE;
        int err;
@@ -298,7 +298,7 @@ COBALT_IMPL(int, pthread_mutex_unlock, (pthread_mutex_t 
*mutex))
        if (_mutex->magic != COBALT_MUTEX_MAGIC)
                return EINVAL;
 
-       cur = xeno_get_current();
+       cur = cobalt_get_current();
        if (cur == XN_NO_HANDLE)
                return EPERM;
 
@@ -314,7 +314,7 @@ COBALT_IMPL(int, pthread_mutex_unlock, (pthread_mutex_t 
*mutex))
        if ((datp->flags & COBALT_MUTEX_COND_SIGNAL))
                goto do_syscall;
 
-       if (xeno_get_current_mode() & XNWEAK)
+       if (cobalt_get_current_mode() & XNWEAK)
                goto do_syscall;
 
        if (xnsynch_fast_release(&datp->owner, cur))
diff --git a/lib/cobalt/printf.c b/lib/cobalt/printf.c
index ff8b060..a6c4ea6 100644
--- a/lib/cobalt/printf.c
+++ b/lib/cobalt/printf.c
@@ -671,7 +671,7 @@ static void spawn_printer_thread(void)
        pthread_attr_t thattr;
 
        pthread_attr_init(&thattr);
-       pthread_attr_setstacksize(&thattr, xeno_stacksize(0));
+       pthread_attr_setstacksize(&thattr, cobalt_get_stacksize(0));
        pthread_create(&printer_thread, &thattr, printer_loop, NULL);
 }
 
@@ -817,8 +817,8 @@ void cobalt_print_exit(void)
 
 COBALT_IMPL(int, vfprintf, (FILE *stream, const char *fmt, va_list args))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_vfprintf(stream, fmt, args);
        else {
                rt_print_flush_buffers();
@@ -857,8 +857,8 @@ COBALT_IMPL(int, printf, (const char *fmt, ...))
 
 COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_fputs(s, stream);
        else {
                rt_print_flush_buffers();
@@ -868,8 +868,8 @@ COBALT_IMPL(int, fputs, (const char *s, FILE *stream))
 
 COBALT_IMPL(int, puts, (const char *s))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_puts(s);
        else {
                rt_print_flush_buffers();
@@ -881,8 +881,8 @@ COBALT_IMPL(int, puts, (const char *s))
 
 COBALT_IMPL(int, fputc, (int c, FILE *stream))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_fputc(c, stream);
        else {
                rt_print_flush_buffers();
@@ -892,8 +892,8 @@ COBALT_IMPL(int, fputc, (int c, FILE *stream))
 
 COBALT_IMPL(int, putchar, (int c))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_putchar(c);
        else {
                rt_print_flush_buffers();
@@ -917,8 +917,8 @@ COBALT_IMPL(int, putchar, (int c))
 
 COBALT_IMPL(size_t, fwrite, (const void *ptr, size_t size, size_t nmemb, FILE 
*stream))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_fwrite(ptr, size, nmemb, stream);
        else {
                rt_print_flush_buffers();
@@ -929,8 +929,8 @@ COBALT_IMPL(size_t, fwrite, (const void *ptr, size_t size, 
size_t nmemb, FILE *s
 
 COBALT_IMPL(void, vsyslog, (int priority, const char *fmt, va_list ap))
 {
-       if (xeno_get_current() != XN_NO_HANDLE &&
-                    !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+                    !(cobalt_get_current_mode() & XNRELAX))
                return rt_vsyslog(priority, fmt, ap);
        else {
                rt_print_flush_buffers();
@@ -953,8 +953,8 @@ COBALT_IMPL(void, syslog, (int priority, const char *fmt, 
...))
 COBALT_IMPL(int, __vfprintf_chk, (FILE *f, int flag, const char *fmt, va_list 
ap))
 {
 #ifdef CONFIG_XENO_FORTIFY
-       if (xeno_get_current() != XN_NO_HANDLE &&
-           !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+           !(cobalt_get_current_mode() & XNRELAX))
                return __rt_vfprintf_chk(f, flag, fmt, ap);
        else {
                rt_print_flush_buffers();
@@ -1001,8 +1001,8 @@ COBALT_IMPL(int, __printf_chk, (int flag, const char 
*fmt, ...))
 COBALT_IMPL(void, __vsyslog_chk, (int pri, int flag, const char *fmt, va_list 
ap))
 {
 #ifdef CONFIG_XENO_FORTIFY
-       if (xeno_get_current() != XN_NO_HANDLE &&
-            !(xeno_get_current_mode() & XNRELAX))
+       if (cobalt_get_current() != XN_NO_HANDLE &&
+            !(cobalt_get_current_mode() & XNRELAX))
                return __rt_vsyslog_chk(pri, flag, fmt, ap);
        else {
                rt_print_flush_buffers();
diff --git a/lib/cobalt/sem_heap.c b/lib/cobalt/sem_heap.c
index 3bdc02e..861f9cf 100644
--- a/lib/cobalt/sem_heap.c
+++ b/lib/cobalt/sem_heap.c
@@ -21,12 +21,12 @@
 
 struct xnvdso *nkvdso;
 
-unsigned long xeno_sem_heap[2] = { 0, 0 };
+unsigned long cobalt_sem_heap[2] = { 0, 0 };
 
 static pthread_once_t init_private_heap = PTHREAD_ONCE_INIT;
 static struct xnheap_desc private_hdesc;
 
-void *xeno_map_heap(struct xnheap_desc *hd)
+void *cobalt_map_heap(struct xnheap_desc *hd)
 {
        int fd, ret;
        void *addr;
@@ -64,7 +64,7 @@ static void *map_sem_heap(unsigned int shared)
                return MAP_FAILED;
        }
 
-       return xeno_map_heap(hdesc);
+       return cobalt_map_heap(hdesc);
 }
 
 static void unmap_on_fork(void)
@@ -82,16 +82,16 @@ static void unmap_on_fork(void)
           that access to these addresses will cause a segmentation
           fault.
        */
-       void *addr = mmap((void *)xeno_sem_heap[PRIVATE],
+       void *addr = mmap((void *)cobalt_sem_heap[PRIVATE],
                          private_hdesc.size, PROT_NONE,
                          MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0);
-       if (addr != (void *)xeno_sem_heap[PRIVATE])
-               munmap((void *)xeno_sem_heap[PRIVATE], private_hdesc.size);
-       xeno_sem_heap[PRIVATE] = 0UL;
+       if (addr != (void *)cobalt_sem_heap[PRIVATE])
+               munmap((void *)cobalt_sem_heap[PRIVATE], private_hdesc.size);
+       cobalt_sem_heap[PRIVATE] = 0UL;
        init_private_heap = PTHREAD_ONCE_INIT;
 }
 
-static void xeno_init_vdso(void)
+static void cobalt_init_vdso(void)
 {
        struct xnsysinfo sysinfo;
        int err;
@@ -103,38 +103,38 @@ static void xeno_init_vdso(void)
                exit(EXIT_FAILURE);
        }
 
-       nkvdso = (struct xnvdso *)(xeno_sem_heap[SHARED] + sysinfo.vdso);
+       nkvdso = (struct xnvdso *)(cobalt_sem_heap[SHARED] + sysinfo.vdso);
 }
 
 /* Will be called once at library loading time, and when re-binding
    after a fork */
-static void xeno_init_private_heap(void)
+static void cobalt_init_private_heap(void)
 {
-       xeno_sem_heap[PRIVATE] = (unsigned long)map_sem_heap(PRIVATE);
-       if (xeno_sem_heap[PRIVATE] == (unsigned long)MAP_FAILED) {
+       cobalt_sem_heap[PRIVATE] = (unsigned long)map_sem_heap(PRIVATE);
+       if (cobalt_sem_heap[PRIVATE] == (unsigned long)MAP_FAILED) {
                perror("Xenomai: mmap local sem heap");
                exit(EXIT_FAILURE);
        }
 }
 
 /* Will be called only once, at library loading time. */
-static void xeno_init_rest_once(void)
+static void cobalt_init_rest_once(void)
 {
        pthread_atfork(NULL, NULL, unmap_on_fork);
 
-       xeno_sem_heap[SHARED] = (unsigned long)map_sem_heap(SHARED);
-       if (xeno_sem_heap[SHARED] == (unsigned long)MAP_FAILED) {
+       cobalt_sem_heap[SHARED] = (unsigned long)map_sem_heap(SHARED);
+       if (cobalt_sem_heap[SHARED] == (unsigned long)MAP_FAILED) {
                perror("Xenomai: mmap global sem heap");
                exit(EXIT_FAILURE);
        }
 
-       xeno_init_vdso();
+       cobalt_init_vdso();
 }
 
-void xeno_init_sem_heaps(void)
+void cobalt_init_sem_heaps(void)
 {
        static pthread_once_t init_rest_once = PTHREAD_ONCE_INIT;
 
-       pthread_once(&init_private_heap, &xeno_init_private_heap);
-       pthread_once(&init_rest_once, &xeno_init_rest_once);
+       pthread_once(&init_private_heap, &cobalt_init_private_heap);
+       pthread_once(&init_rest_once, &cobalt_init_rest_once);
 }
diff --git a/lib/cobalt/sem_heap.h b/lib/cobalt/sem_heap.h
index 16dedda..95392c7 100644
--- a/lib/cobalt/sem_heap.h
+++ b/lib/cobalt/sem_heap.h
@@ -3,6 +3,6 @@
 
 #include <xeno_config.h>
 
-void xeno_init_sem_heaps(void);
+void cobalt_init_sem_heaps(void);
 
 #endif /* XENO_SEM_HEAP_H */
diff --git a/lib/cobalt/semaphore.c b/lib/cobalt/semaphore.c
index 13741f9..f6b2621 100644
--- a/lib/cobalt/semaphore.c
+++ b/lib/cobalt/semaphore.c
@@ -28,7 +28,7 @@
 
 COBALT_IMPL(int, sem_init, (sem_t *sem, int pshared, unsigned value))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        err = -XENOMAI_SKINCALL3(__cobalt_muxid,
@@ -43,7 +43,7 @@ COBALT_IMPL(int, sem_init, (sem_t *sem, int pshared, unsigned 
value))
 
 COBALT_IMPL(int, sem_destroy, (sem_t *sem))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        if (_sem->magic != COBALT_SEM_MAGIC
@@ -62,7 +62,7 @@ COBALT_IMPL(int, sem_destroy, (sem_t *sem))
 
 COBALT_IMPL(int, sem_post, (sem_t *sem))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        if (_sem->magic != COBALT_SEM_MAGIC
@@ -81,7 +81,7 @@ COBALT_IMPL(int, sem_post, (sem_t *sem))
 
 COBALT_IMPL(int, sem_wait, (sem_t *sem))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err, oldtype;
 
        if (_sem->magic != COBALT_SEM_MAGIC
@@ -105,7 +105,7 @@ COBALT_IMPL(int, sem_wait, (sem_t *sem))
 
 COBALT_IMPL(int, sem_timedwait, (sem_t *sem, const struct timespec *ts))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err, oldtype;
 
        if (_sem->magic != COBALT_SEM_MAGIC
@@ -130,7 +130,7 @@ COBALT_IMPL(int, sem_timedwait, (sem_t *sem, const struct 
timespec *ts))
 
 COBALT_IMPL(int, sem_trywait, (sem_t *sem))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        if (_sem->magic != COBALT_SEM_MAGIC
@@ -149,7 +149,7 @@ COBALT_IMPL(int, sem_trywait, (sem_t *sem))
 
 COBALT_IMPL(int, sem_getvalue, (sem_t *sem, int *sval))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        if (_sem->magic != COBALT_SEM_MAGIC
@@ -169,7 +169,7 @@ COBALT_IMPL(int, sem_getvalue, (sem_t *sem, int *sval))
 
 COBALT_IMPL(sem_t *, sem_open, (const char *name, int oflags, ...))
 {
-       union __xeno_sem *sem, *rsem;
+       union cobalt_sem_union *sem, *rsem;
        unsigned value = 0;
        mode_t mode = 0;
        va_list ap;
@@ -182,7 +182,7 @@ COBALT_IMPL(sem_t *, sem_open, (const char *name, int 
oflags, ...))
                va_end(ap);
        }
 
-       rsem = sem = (union __xeno_sem *)malloc(sizeof(*sem));
+       rsem = sem = (union cobalt_sem_union *)malloc(sizeof(*sem));
 
        if (!rsem) {
                err = ENOSPC;
@@ -207,7 +207,7 @@ COBALT_IMPL(sem_t *, sem_open, (const char *name, int 
oflags, ...))
 
 COBALT_IMPL(int, sem_close, (sem_t *sem))
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err, closed;
 
        if (_sem->magic != COBALT_NAMED_SEM_MAGIC) {
@@ -243,7 +243,7 @@ COBALT_IMPL(int, sem_unlink, (const char *name))
 
 int sem_init_np(sem_t *sem, int flags, unsigned int value)
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        err = -XENOMAI_SKINCALL3(__cobalt_muxid,
@@ -257,7 +257,7 @@ int sem_init_np(sem_t *sem, int flags, unsigned int value)
 
 int sem_broadcast_np(sem_t *sem)
 {
-       struct __shadow_sem *_sem = &((union __xeno_sem *)sem)->shadow_sem;
+       struct __shadow_sem *_sem = &((union cobalt_sem_union 
*)sem)->shadow_sem;
        int err;
 
        if (_sem->magic != COBALT_SEM_MAGIC
diff --git a/lib/cobalt/sigshadow.c b/lib/cobalt/sigshadow.c
index 7f94ca5..37cb267 100644
--- a/lib/cobalt/sigshadow.c
+++ b/lib/cobalt/sigshadow.c
@@ -14,13 +14,13 @@ static inline int backtrace(void **buffer, int size)
 #include <execinfo.h>
 #endif /* !__UCLIBC__ */
 
-static struct sigaction xeno_saved_sigshadow_action;
+static struct sigaction sigshadow_action_orig;
 
 /*
  * The following handler is part of the inner user-interface: should
  * remain extern.
  */
-int xeno_sigwinch_handler(int sig, siginfo_t *si, void *ctxt)
+int cobalt_sigshadow_handler(int sig, siginfo_t *si, void *ctxt)
 {
        void *frames[SIGSHADOW_BACKTRACE_DEPTH];
        int action, arg, nr, skip;
@@ -48,12 +48,12 @@ int xeno_sigwinch_handler(int sig, siginfo_t *si, void 
*ctxt)
        return 1;
 }
 
-static void xeno_sigshadow_handler(int sig, siginfo_t *si, void *ctxt)
+static void sigshadow_handler(int sig, siginfo_t *si, void *ctxt)
 {
-       const struct sigaction *const sa = &xeno_saved_sigshadow_action;
+       const struct sigaction *const sa = &sigshadow_action_orig;
        sigset_t saved_sigset;
 
-       if (xeno_sigwinch_handler(sig, si, ctxt))
+       if (cobalt_sigshadow_handler(sig, si, ctxt))
                return;
 
        /* Not a signal sent by the Xenomai nucleus */
@@ -81,20 +81,20 @@ static void install_sigshadow(void)
        sigaddset(&mask_sigset, SIGSHADOW);
 
        new_sigshadow_action.sa_flags = SA_SIGINFO | SA_RESTART;
-       new_sigshadow_action.sa_sigaction = xeno_sigshadow_handler;
+       new_sigshadow_action.sa_sigaction = sigshadow_handler;
        sigemptyset(&new_sigshadow_action.sa_mask);
        pthread_sigmask(SIG_BLOCK, &mask_sigset, &saved_sigset);
 
        sigaction(SIGSHADOW,
-                 &new_sigshadow_action, &xeno_saved_sigshadow_action);
+                 &new_sigshadow_action, &sigshadow_action_orig);
 
-       if ((xeno_saved_sigshadow_action.sa_flags & SA_NODEFER) == 0)
-               sigaddset(&xeno_saved_sigshadow_action.sa_mask, SIGSHADOW);
+       if ((sigshadow_action_orig.sa_flags & SA_NODEFER) == 0)
+               sigaddset(&sigshadow_action_orig.sa_mask, SIGSHADOW);
 
        pthread_sigmask(SIG_SETMASK, &saved_sigset, NULL);
 }
 
-void xeno_sigshadow_install_once(void)
+void cobalt_sigshadow_install_once(void)
 {
        static pthread_once_t once = PTHREAD_ONCE_INIT;
        pthread_once(&once, install_sigshadow);
diff --git a/lib/cobalt/sysdeps/nios2/features.c 
b/lib/cobalt/sysdeps/nios2/features.c
index 6a60f08..16fded5 100644
--- a/lib/cobalt/sysdeps/nios2/features.c
+++ b/lib/cobalt/sysdeps/nios2/features.c
@@ -27,7 +27,7 @@
 #include <asm/xenomai/syscall.h>
 #include "internal.h"
 
-__attribute__((weak)) volatile void *xeno_nios2_hrclock = NULL;
+__attribute__((weak)) volatile void *__cobalt_nios2_hrclock = NULL;
 
 static inline void cobalt_check_features(struct xnfeatinfo *finfo)
 {
@@ -51,5 +51,5 @@ static inline void cobalt_check_features(struct xnfeatinfo 
*finfo)
        }
        __STD(close(fd));
 
-       xeno_nios2_hrclock = (volatile void *)(p + (pa & (pagesz - 1)));
+       __cobalt_nios2_hrclock = (volatile void *)(p + (pa & (pagesz - 1)));
 }
diff --git a/lib/cobalt/sysdeps/sh/features.c b/lib/cobalt/sysdeps/sh/features.c
index 368e116..74b018d 100644
--- a/lib/cobalt/sysdeps/sh/features.c
+++ b/lib/cobalt/sysdeps/sh/features.c
@@ -31,12 +31,12 @@
 struct xnarch_tsc_area;
 
 __attribute__((weak))
-volatile struct xnarch_tsc_area *xeno_sh_tsc = NULL;
+volatile struct xnarch_tsc_area *__cobalt_sh_tsc = NULL;
 
 __attribute__((weak))
-volatile unsigned long *xeno_sh_tcnt = NULL;
+volatile unsigned long *__cobalt_sh_tcnt = NULL;
 
-static volatile void *__xeno_kmem_map(unsigned long pa, unsigned int pagesz)
+static volatile void *map_kmem(unsigned long pa, unsigned int pagesz)
 {
        void *p;
        int fd;
@@ -62,6 +62,6 @@ void cobalt_chech_features(struct xnfeatinfo *finfo)
 {
        unsigned int pagesz = sysconf(_SC_PAGESIZE);
 
-       xeno_sh_tsc = __xeno_kmem_map(finfo->feat_arch.hrclock_membase, pagesz);
-       xeno_sh_tcnt = __xeno_kmem_map(xeno_sh_tsc->counter_pa, pagesz);
+       __cobalt_sh_tsc = map_kmem(finfo->feat_arch.hrclock_membase, pagesz);
+       __cobalt_sh_tcnt = map_kmem(__cobalt_sh_tsc->counter_pa, pagesz);
 }
diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index 005a7a1..8d713a6 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -81,7 +81,7 @@ COBALT_IMPL(int, pthread_setschedparam, (pthread_t thread,
 int pthread_setschedparam_ex(pthread_t thread,
                             int policy, const struct sched_param_ex *param)
 {
-       unsigned long mode_offset;
+       unsigned long u_winoff;
        int ret, promoted;
 
        /*
@@ -95,13 +95,13 @@ int pthread_setschedparam_ex(pthread_t thread,
        ret = -XENOMAI_SKINCALL5(__cobalt_muxid,
                                 sc_cobalt_thread_setschedparam_ex,
                                 thread, policy, param,
-                                &mode_offset, &promoted);
+                                &u_winoff, &promoted);
 
        if (ret == 0 && promoted) {
-               xeno_fault_stack();
-               xeno_sigshadow_install_once();
-               xeno_set_current();
-               xeno_set_current_window(mode_offset);
+               cobalt_prefault_stack();
+               cobalt_sigshadow_install_once();
+               cobalt_set_current();
+               cobalt_set_current_window(u_winoff);
                if (policy != SCHED_OTHER && policy != SCHED_WEAK)
                        XENOMAI_SYSCALL1(sc_nucleus_migrate, 
XENOMAI_XENO_DOMAIN);
        }
@@ -210,12 +210,12 @@ static void *__pthread_trampoline(void *p)
        void *(*start)(void *), *arg, *retval;
        struct pthread_iargs *iargs = p;
        struct sched_param_ex param_ex;
-       unsigned long mode_offset;
        int parent_prio, policy;
+       unsigned long u_winoff;
        long ret;
 
-       xeno_sigshadow_install_once();
-       xeno_fault_stack();
+       cobalt_sigshadow_install_once();
+       cobalt_prefault_stack();
 
        param_ex = iargs->param_ex;
        policy = iargs->policy;
@@ -233,10 +233,10 @@ static void *__pthread_trampoline(void *p)
         * macro: this trashes the syscall regs on some archs.
         */
        ret = XENOMAI_SKINCALL4(__cobalt_muxid, sc_cobalt_thread_create, tid,
-                               policy, &param_ex, &mode_offset);
+                               policy, &param_ex, &u_winoff);
        if (ret == 0) {
-               xeno_set_current();
-               xeno_set_current_window(mode_offset);
+               cobalt_set_current();
+               cobalt_set_current_window(u_winoff);
        }
 
        /*
@@ -313,7 +313,7 @@ int pthread_create_ex(pthread_t *tid,
 
        pthread_attr_getdetachstate(&attr, &detachstate);
        pthread_attr_getstacksize(&attr, &stksz);
-       pthread_attr_setstacksize(&attr, xeno_stacksize(stksz));
+       pthread_attr_setstacksize(&attr, cobalt_get_stacksize(stksz));
 
        /*
         * First start a native POSIX thread, then mate a Xenomai
diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index cb001d1..ee52df5 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -97,8 +97,8 @@ static inline void threadobj_init_corespec(struct threadobj 
*thobj)
 static inline int threadobj_setup_corespec(struct threadobj *thobj)
 {
        pthread_set_name_np(pthread_self(), thobj->name);
-       thobj->core.handle = xeno_get_current();
-       thobj->core.u_window = xeno_get_current_window();
+       thobj->core.handle = cobalt_get_current();
+       thobj->core.u_window = cobalt_get_current_window();
 
        return 0;
 }
diff --git a/testsuite/switchtest/switchtest.c 
b/testsuite/switchtest/switchtest.c
index 2c34967..964fd36 100644
--- a/testsuite/switchtest/switchtest.c
+++ b/testsuite/switchtest/switchtest.c
@@ -44,8 +44,8 @@ typedef unsigned long cpu_set_t;
 #define smp_sched_setaffinity(pid,len,mask) 0
 #endif /* !CONFIG_SMP */
 
-#define SMALL_STACK_MIN xeno_stacksize(32 * 1024)
-#define LARGE_STACK_MIN xeno_stacksize(64 * 1024)
+#define SMALL_STACK_MIN cobalt_get_stacksize(32 * 1024)
+#define LARGE_STACK_MIN cobalt_get_stacksize(64 * 1024)
 
 /* Thread type. */
 typedef enum {
diff --git a/testsuite/unit/check-vdso.c b/testsuite/unit/check-vdso.c
index d162b63..bfc5142 100644
--- a/testsuite/unit/check-vdso.c
+++ b/testsuite/unit/check-vdso.c
@@ -8,7 +8,7 @@
 #include <asm/xenomai/syscall.h>
 #include <cobalt/kernel/vdso.h>
 
-extern unsigned long xeno_sem_heap[2];
+extern unsigned long cobalt_sem_heap[2];
 
 int main(int argc, char **argv)
 {
@@ -21,7 +21,7 @@ int main(int argc, char **argv)
                test_features = strtoull(argv[1], NULL, 0);
        }
 
-       if (!xeno_sem_heap[1]) {
+       if (!cobalt_sem_heap[1]) {
                fprintf(stderr, "Could not determine position of the "
                        "global semaphore heap\n");
                return 1;
diff --git a/testsuite/unit/cond-torture.c b/testsuite/unit/cond-torture.c
index a9aa6dd..46a9978 100644
--- a/testsuite/unit/cond-torture.c
+++ b/testsuite/unit/cond-torture.c
@@ -129,7 +129,7 @@ int thread_spawn(pthread_t *thread, int prio,
        param.sched_priority = prio;
        pthread_attr_setschedparam(&tattr, &param);
        pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_JOINABLE);
-       pthread_attr_setstacksize(&tattr, xeno_stacksize(0));
+       pthread_attr_setstacksize(&tattr, cobalt_get_stacksize(0));
 
        err = pthread_create(thread, &tattr, handler, cookie);
 
diff --git a/testsuite/unit/mutex-torture.c b/testsuite/unit/mutex-torture.c
index 69edbc6..d9e30ef 100644
--- a/testsuite/unit/mutex-torture.c
+++ b/testsuite/unit/mutex-torture.c
@@ -102,9 +102,9 @@ void check_current_mode(int mask, int expected_value)
        int current_mode;
 
        /* This is a unit test, and in this circonstance, we are allowed to
-          call xeno_get_current_mode. But please do not do that in your
+          call cobalt_get_current_mode. But please do not do that in your
           own code. */
-       current_mode = xeno_get_current_mode() & mask;
+       current_mode = cobalt_get_current_mode() & mask;
 
        if (current_mode != expected_value) {
                fprintf(stderr,
@@ -207,7 +207,7 @@ int dispatch(const char *service_name,
                pthread_attr_setschedparam(&threadattr, &param);
                pthread_attr_setinheritsched(&threadattr,
                                             PTHREAD_EXPLICIT_SCHED);
-               pthread_attr_setstacksize(&threadattr, xeno_stacksize(0));
+               pthread_attr_setstacksize(&threadattr, cobalt_get_stacksize(0));
                handler = va_arg(ap, void *);
                status = pthread_create(thread, &threadattr, handler,
                                        va_arg(ap, void *));


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

Reply via email to