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

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Feb 25 23:33:46 2010 +0100

Avoid false error reports of xeno_handle_mlock_alert

We already propagate the SIGDEBUG reason to user space. Use it to tell
SIGDEBUG_NOMLOCK apart from other triggers of this signal, e.g. the
watchdog. This also allows to drop xeno_sigxcpu_no_mlock.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/asm-generic/bits/bind.h        |    6 +++---
 include/asm-generic/bits/mlock_alert.h |    4 +---
 src/skins/common/bind.c                |    4 ++--
 src/skins/native/task.c                |   15 ---------------
 src/skins/posix/thread.c               |    9 ---------
 src/skins/psos+/init.c                 |    1 -
 6 files changed, 6 insertions(+), 33 deletions(-)

diff --git a/include/asm-generic/bits/bind.h b/include/asm-generic/bits/bind.h
index 7267e0d..1aeffb5 100644
--- a/include/asm-generic/bits/bind.h
+++ b/include/asm-generic/bits/bind.h
@@ -9,7 +9,7 @@ union xnsiginfo;
 
 typedef void xnsighandler(union xnsiginfo *si);
 
-void xeno_handle_mlock_alert(int sig);
+void xeno_handle_mlock_alert(int sig, siginfo_t *si, void *context);
 
 int 
 xeno_bind_skin_opt(unsigned skin_magic, const char *skin, 
@@ -29,9 +29,9 @@ xeno_bind_skin(unsigned skin_magic, const char *skin,
                exit(EXIT_FAILURE);
        }
 
-       sa.sa_handler = &xeno_handle_mlock_alert;
+       sa.sa_sigaction = xeno_handle_mlock_alert;
        sigemptyset(&sa.sa_mask);
-       sa.sa_flags = 0;
+       sa.sa_flags = SA_SIGINFO;
        sigaction(SIGXCPU, &sa, NULL);
 
        return muxid;
diff --git a/include/asm-generic/bits/mlock_alert.h 
b/include/asm-generic/bits/mlock_alert.h
index 6a4e3cd..5b2f73f 100644
--- a/include/asm-generic/bits/mlock_alert.h
+++ b/include/asm-generic/bits/mlock_alert.h
@@ -1,8 +1,6 @@
 #ifndef _XENO_ASM_GENERIC_BITS_MLOCK_ALERT_H
 #define _XENO_ASM_GENERIC_BITS_MLOCK_ALERT_H
 
-extern int xeno_sigxcpu_no_mlock;
-
-void xeno_handle_mlock_alert(int sig);
+void xeno_handle_mlock_alert(int sig, siginfo_t *si, void *context);
 
 #endif /* _XENO_ASM_GENERIC_BITS_MLOCK_ALERT_H */
diff --git a/src/skins/common/bind.c b/src/skins/common/bind.c
index 3967cce..352c4e8 100644
--- a/src/skins/common/bind.c
+++ b/src/skins/common/bind.c
@@ -154,11 +154,11 @@ void xeno_fault_stack(void)
        stk[0] = stk[sizeof(stk) - 1] = 0xA5;
 }
 
-void xeno_handle_mlock_alert(int sig)
+void xeno_handle_mlock_alert(int sig, siginfo_t *si, void *context)
 {
        struct sigaction sa;
 
-       if (xeno_sigxcpu_no_mlock) {
+       if (si->si_value.sival_int == SIGDEBUG_NOMLOCK) {
                fprintf(stderr, "Xenomai: process memory not locked "
                        "(missing mlockall?)\n");
                fflush(stderr);
diff --git a/src/skins/native/task.c b/src/skins/native/task.c
index 1dde653..2c0c114 100644
--- a/src/skins/native/task.c
+++ b/src/skins/native/task.c
@@ -41,7 +41,6 @@ extern pthread_key_t __native_tskey;
 #endif /* !HAVE___THREAD */
 
 extern int __native_muxid;
-extern int xeno_sigxcpu_no_mlock;
 
 /* Public Xenomai interface. */
 
@@ -97,9 +96,6 @@ static void *rt_task_trampoline(void *cookie)
 
        xeno_set_current();
 
-       if (iargs->mode & T_WARNSW)
-               xeno_sigxcpu_no_mlock = 0;
-
        /* Wait on the barrier for the task to be started. The barrier
           could be released in order to process Linux signals while the
           Xenomai shadow is still dormant; in such a case, resume wait. */
@@ -231,9 +227,6 @@ int rt_task_shadow(RT_TASK *task, const char *name, int 
prio, int mode)
 
        xeno_set_current();
 
-       if (mode & T_WARNSW)
-               xeno_sigxcpu_no_mlock = 0;
-
        return 0;
 
   fail:
@@ -347,14 +340,6 @@ int rt_task_set_mode(int clrmask, int setmask, int 
*oldmode)
                                __native_task_set_mode, clrmask, setmask,
                                oldmode);
 
-       /* Silently deactivate our internal handler for SIGXCPU. At that
-          point, we know that the process memory has been properly
-          locked, otherwise we would have caught the latter signal upon
-          thread creation. */
-
-       if (!err && xeno_sigxcpu_no_mlock)
-               xeno_sigxcpu_no_mlock = !(setmask & T_WARNSW);
-
        return err;
 }
 
diff --git a/src/skins/posix/thread.c b/src/skins/posix/thread.c
index 86a6c5d..bc5572f 100644
--- a/src/skins/posix/thread.c
+++ b/src/skins/posix/thread.c
@@ -330,20 +330,11 @@ int pthread_wait_np(unsigned long *overruns_r)
 
 int pthread_set_mode_np(int clrmask, int setmask)
 {
-       extern int xeno_sigxcpu_no_mlock;
        int err;
 
        err = -XENOMAI_SKINCALL2(__pse51_muxid,
                                 __pse51_thread_set_mode, clrmask, setmask);
 
-       /* Silently deactivate our internal handler for SIGXCPU. At that
-          point, we know that the process memory has been properly
-          locked, otherwise we would have caught the latter signal upon
-          thread creation. */
-
-       if (!err && xeno_sigxcpu_no_mlock)
-               xeno_sigxcpu_no_mlock = !(setmask & PTHREAD_WARNSW);
-
        return err;
 }
 
diff --git a/src/skins/psos+/init.c b/src/skins/psos+/init.c
index 7263925..a835454 100644
--- a/src/skins/psos+/init.c
+++ b/src/skins/psos+/init.c
@@ -20,7 +20,6 @@
 #include <errno.h>
 #include <sys/mman.h>
 #include <psos+/psos.h>
-#include <asm-generic/bits/mlock_alert.h>
 #include <asm/xenomai/bits/bind.h>
 
 int __psos_muxid = -1;


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

Reply via email to