[vlc-commits] signals: ugly and unsafe kludge to run the QProcess SIGCHLD handler

Rémi Denis-Courmont git at videolan.org
Tue Feb 1 19:37:49 CET 2011


vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Feb  1 20:36:07 2011 +0200| [a98cae2562e1cd5e8a874fb7fe487f6f71f1cf99] | committer: Rémi Denis-Courmont

signals: ugly and unsafe kludge to run the QProcess SIGCHLD handler

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=a98cae2562e1cd5e8a874fb7fe487f6f71f1cf99
---

 configure.ac              |    2 +-
 modules/control/signals.c |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index f5c8216..ec51449 100644
--- a/configure.ac
+++ b/configure.ac
@@ -771,7 +771,7 @@ if test "${ac_cv_have_plugins}" = "no" -o "${SYS}" = "darwin"; then
   if test "${ac_cv_my_have_dlopen}" = "yes"; then
     AC_DEFINE(HAVE_DL_DLOPEN, 1, [Define if you have the dlopen API])
     ac_cv_have_plugins=yes
-    VLC_ADD_LIBS([libvlccore realvideo lua],[$LIBDL])
+    VLC_ADD_LIBS([libvlccore realvideo lua signals],[$LIBDL])
   fi
 fi
 AC_SUBST(LIBDL)
diff --git a/modules/control/signals.c b/modules/control/signals.c
index 5cb6f36..4c8de9d 100644
--- a/modules/control/signals.c
+++ b/modules/control/signals.c
@@ -28,6 +28,9 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_interface.h>
+#ifdef __GLIBC__
+# include <dlfcn.h>
+#endif
 
 static int  Open (vlc_object_t *);
 static void Close (vlc_object_t *);
@@ -118,6 +121,30 @@ static void *SigThread (void *data)
          * cancellation point */
         vlc_testcancel();
 #endif
+
+       /* Hack for Qt QProcess */
+       if (signum == SIGCHLD)
+       {
+           struct sigaction act;
+
+           sigaction (signum, NULL, &act);
+           if ((act.sa_flags & SA_SIGINFO) || (act.sa_handler != SIG_DFL))
+           {
+               msg_Err (obj, "signal %d overriden (%p)", signum,
+                        act.sa_handler);
+#ifdef __GLIBC__
+               Dl_info info;
+
+               if (dladdr (act.sa_handler, &info))
+                   msg_Err (obj, " %s(%s)[%p]",
+                            info.dli_fname ? info.dli_fname : "?",
+                            info.dli_sname ? info.dli_sname : "?",
+                            info.dli_saddr);
+#endif
+               if (!(act.sa_flags & SA_SIGINFO) && (act.sa_handler != SIG_IGN))
+                   act.sa_handler (signum);
+           }
+       }
     }
     while (signum == SIGCHLD);
 



More information about the vlc-commits mailing list