Module: xenomai-jki
Branch: for-upstream
Commit: b7940ae7699b5a371d538d1a8e22be07c3d36bf7
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=b7940ae7699b5a371d538d1a8e22be07c3d36bf7

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 |    7 ++-----
 src/skins/native/task.c                |   15 ---------------
 src/skins/posix/thread.c               |    9 ---------
 4 files changed, 5 insertions(+), 32 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 6c7217d..eded3c1 100644
--- a/include/asm-generic/bits/mlock_alert.h
+++ b/include/asm-generic/bits/mlock_alert.h
@@ -6,15 +6,12 @@
 #include <signal.h>
 #include <pthread.h>
 
-__attribute__ ((weak))
-int xeno_sigxcpu_no_mlock = 1;
-
 __attribute__ ((weak, visibility ("internal")))
-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 ba04a27..6312f2f 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 d565d52..8084a20 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;
 }
 


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

Reply via email to