+ static const int exitsigs[] = { SIGINT, SIGHUP, SIGQUIT, SIGTERM };
+ /* Signals that cause a no-op:
+ * - SIGALRM should not happen, but lets stay on the safe side.
+ * - SIGPIPE might happen with sockets and would crash VLC. It MUST be
+ * blocked by any LibVLC-dependant application, in addition to VLC.
+ * - SIGCHLD is comes after exec*() (such as httpd CGI support) and must
+ * be dequeued to cleanup zombie processes.
+ */
+ static const int dummysigs[] = { SIGALRM, SIGPIPE, SIGCHLD };
+
+ sigset_t set;
+ pthread_t sigth;
+
+ sigemptyset (&set);
+ for (unsigned i = 0; i < sizeof (exitsigs) / sizeof (exitsigs[0]); i++)
+ sigaddset (&set, exitsigs[i]);
+ for (unsigned i = 0; i < sizeof (dummysigs) / sizeof (dummysigs[0]); i++)
+ sigaddset (&set, dummysigs[i]);
+
+ /* Block all these signals */
+ pthread_sigmask (SIG_BLOCK, &set, NULL);
+
+ for (unsigned i = 0; i < sizeof (dummysigs) / sizeof (dummysigs[0]); i++)
+ sigdelset (&set, dummysigs[i]);
+
+ pthread_create (&sigth, NULL, SigHandler, &set);
+#endif
+
+#ifdef WIN32
+ /* Replace argv[1..n] with unicode for Windows NT and above */
+ if( GetVersion() < 0x80000000 )
+ {
+ wchar_t **wargv, **wenvp;
+ int i,i_wargc;
+ int si = { 0 };
+ __wgetmainargs(&i_wargc, &wargv, &wenvp, 0, &si);