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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Mar 28 19:42:50 2010 +0200

common: use vdso to detect presence of the drop_u_mode syscall.

---

 include/asm-generic/bits/current.h |    1 +
 include/nucleus/vdso.h             |    4 ++--
 src/skins/common/current.c         |   19 ++++++++-----------
 src/skins/common/sem_heap.c        |    4 ++++
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/include/asm-generic/bits/current.h 
b/include/asm-generic/bits/current.h
index 8a213d2..0f299ea 100644
--- a/include/asm-generic/bits/current.h
+++ b/include/asm-generic/bits/current.h
@@ -8,6 +8,7 @@ extern pthread_key_t xeno_current_mode_key;
 
 xnhandle_t xeno_slow_get_current(void);
 unsigned long xeno_slow_get_current_mode(void);
+void xeno_current_warn_old(void);
 
 #ifdef HAVE___THREAD
 extern __thread xnhandle_t xeno_current __attribute__ ((tls_model 
("initial-exec")));
diff --git a/include/nucleus/vdso.h b/include/nucleus/vdso.h
index 65e081a..c431f88 100644
--- a/include/nucleus/vdso.h
+++ b/include/nucleus/vdso.h
@@ -47,8 +47,8 @@ struct xnvdso {
 #define XNVDSO_FEAT_C  0x0000000000000004ULL
 #define XNVDSO_FEATURES        (XNVDSO_FEAT_A | XNVDSO_FEAT_B | XVDSO_FEAT_C)
 */
-
-#define XNVDSO_FEATURES 0x0000000000000000ULL
+#define XNVDSO_FEAT_DROP_U_MODE 0x0000000000000001ULL
+#define XNVDSO_FEATURES (XNVDSO_FEAT_DROP_U_MODE)
 
 extern struct xnvdso *nkvdso;
 
diff --git a/src/skins/common/current.c b/src/skins/common/current.c
index 4011cae..7f36991 100644
--- a/src/skins/common/current.c
+++ b/src/skins/common/current.c
@@ -6,6 +6,7 @@
 #include <asm/xenomai/syscall.h>
 #include <nucleus/types.h>
 #include <nucleus/thread.h>
+#include <nucleus/vdso.h>
 
 pthread_key_t xeno_current_mode_key;
 
@@ -66,24 +67,20 @@ static inline void free_current_mode(unsigned long *mode)
 
 #endif /* !HAVE___THREAD */
 
+void xeno_current_warn_old(void)
+{
+       fprintf(stderr, XENO_MODE_LEAK_WARNING);
+}
+
 static void cleanup_current_mode(void *key)
 {
        unsigned long *mode = key;
-       int err;
 
        *mode = -1;
 
-       err = XENOMAI_SYSCALL0(__xn_sys_drop_u_mode);
-
-       if (!err)
+       if (xnvdso_test_feature(XNVDSO_FEAT_DROP_U_MODE)) {
+               XENOMAI_SYSCALL0(__xn_sys_drop_u_mode);
                free_current_mode(mode);
-       else {
-               static int warned;
-
-               if (!warned) {
-                       warned = 1;
-                       fprintf(stderr, XENO_MODE_LEAK_WARNING);
-               }
        }
 }
 
diff --git a/src/skins/common/sem_heap.c b/src/skins/common/sem_heap.c
index 97888f1..bf7031d 100644
--- a/src/skins/common/sem_heap.c
+++ b/src/skins/common/sem_heap.c
@@ -10,7 +10,9 @@
 #include <sys/ioctl.h>
 #include <sys/mman.h>
 
+#include <nucleus/vdso.h>
 #include <asm/xenomai/syscall.h>
+#include <asm-generic/bits/current.h>
 
 #include "sem_heap.h"
 
@@ -91,6 +93,8 @@ static void xeno_init_vdso(void)
        }
 
        nkvdso = (struct xnvdso *)(xeno_sem_heap[1] + sysinfo.vdso);
+       if (!xnvdso_test_feature(XNVDSO_FEAT_DROP_U_MODE))
+               xeno_current_warn_old();
 }
 
 static void xeno_init_sem_heaps_inner(void)


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

Reply via email to