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

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Mon Mar  8 12:00:34 2010 +0100

common: modify leak warning

---

 src/skins/common/current.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/src/skins/common/current.c b/src/skins/common/current.c
index 7277189..5d418a4 100644
--- a/src/skins/common/current.c
+++ b/src/skins/common/current.c
@@ -29,8 +29,6 @@ static inline unsigned long *create_current_mode(void)
 
 static inline void free_current_mode(unsigned long *mode) { }
 
-#define XENO_MODE_LEAK_WARNING ""
-
 #else /* !HAVE___THREAD */
 
 pthread_key_t xeno_current_key;
@@ -56,8 +54,9 @@ static inline void free_current_mode(unsigned long *mode)
 }
 
 #define XENO_MODE_LEAK_WARNING \
-       "         To reduce the probality, we leak a few bytes of heap " \
-       "per thread.\n"
+       "Xenomai: WARNING, this version of Xenomai kernel is anterior to" \
+       " 2.5.2.\nIn order to avoid getting memory corruption, we leak 4" \
+       " bytes per thread.\nUpgrade is recommended.\n"
 
 #endif /* !HAVE___THREAD */
 
@@ -70,20 +69,18 @@ static void cleanup_current_mode(void *key)
 
        err = XENOMAI_SYSCALL0(__xn_sys_drop_u_mode);
 
-       if (err) {
+       if (!err)
+               free_current_mode(mode);
+#ifdef XENO_MODE_LEAK_WARNING
+       else {
                static int warned;
 
                if (!warned) {
                        warned = 1;
-                       fprintf(stderr,
-                               "\nXenomai: WARNING, this Xenomai kernel can "
-                                       "cause spurious application\n"
-                               "         crashes on thread termination. "
-                                       "Upgrade is highly recommended.\n%s\n",
-                               XENO_MODE_LEAK_WARNING);
+                       fprintf(stderr, XENO_MODE_LEAK_WARNING);
                }
-       } else
-               free_current_mode(mode);
+       }
+#endif /* XENO_MODE_LEAK_WARNING */
 }
 
 static void init_current_keys(void)


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

Reply via email to