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

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Tue Apr 23 14:26:18 2013 +0200

posix: Control auto-shadowing via environment variable

There is no need anymore to disable auto-shadowing when dlopen support
is enabled as we preserver the scheduling parameters of the context.

Instead, port the environment variable based control from -forge to 2.6:
Only if XENO_NOSHADOW is set to a non-empty string, we refrain from
shadowing the caller of the POSIX skin init function.

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

---

 src/skins/posix/init.c |   35 ++++++++++++++++++-----------------
 1 files changed, 18 insertions(+), 17 deletions(-)

diff --git a/src/skins/posix/init.c b/src/skins/posix/init.c
index 36ef397..10de01e 100644
--- a/src/skins/posix/init.c
+++ b/src/skins/posix/init.c
@@ -43,11 +43,10 @@ void pse51_clock_init(int);
 static __attribute__ ((constructor))
 void __init_posix_interface(void)
 {
-#ifndef CONFIG_XENO_LIBS_DLOPEN
        struct sched_param parm;
        int policy;
-#endif /* !CONFIG_XENO_LIBS_DLOPEN */
        int muxid, err;
+       const char *noshadow;
 
        rt_print_auto_init(1);
 
@@ -68,22 +67,24 @@ void __init_posix_interface(void)
                                                                 
__rtdm_fdcount);
        }
 
-       /* Don't use auto-shadowing if we are likely invoked from dlopen. */
-#ifndef CONFIG_XENO_LIBS_DLOPEN
-       err = __real_pthread_getschedparam(pthread_self(), &policy, &parm);
-       if (err) {
-               fprintf(stderr, "Xenomai Posix skin init: "
-                       "pthread_getschedparam: %s\n", strerror(err));
-               exit(EXIT_FAILURE);
-       }
-
-       err = __wrap_pthread_setschedparam(pthread_self(), policy, &parm);
-       if (err) {
-               fprintf(stderr, "Xenomai Posix skin init: "
-                       "pthread_setschedparam: %s\n", strerror(err));
-               exit(EXIT_FAILURE);
+       noshadow = getenv("XENO_NOSHADOW");
+       if (!noshadow || !*noshadow) {
+               err = __real_pthread_getschedparam(pthread_self(), &policy,
+                                                  &parm);
+               if (err) {
+                       fprintf(stderr, "Xenomai Posix skin init: "
+                               "pthread_getschedparam: %s\n", strerror(err));
+                       exit(EXIT_FAILURE);
+               }
+
+               err = __wrap_pthread_setschedparam(pthread_self(), policy,
+                                                  &parm);
+               if (err) {
+                       fprintf(stderr, "Xenomai Posix skin init: "
+                               "pthread_setschedparam: %s\n", strerror(err));
+                       exit(EXIT_FAILURE);
+               }
        }
-#endif /* !CONFIG_XENO_LIBS_DLOPEN */
 
        if (fork_handler_registered)
                return;


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

Reply via email to