I recall this is Linux specific, If so add an ifdef

On Friday, October 7, 2011, Enlightenment SVN <no-re...@enlightenment.org>
wrote:
> Log:
> Ecore Exe: add flag to send SIGTERM when parent die
>
>  Add a new ecore exe flag, ECORE_EXE_TERM_WITH_PARENT,
>  that will operate on child process,
>  sending a SIGTERM when parent process dies.
>
>
>
> Author:       bdilly
> Date:         2011-10-07 16:37:42 -0700 (Fri, 07 Oct 2011)
> New Revision: 63915
> Trac:         http://trac.enlightenment.org/e/changeset/63915
>
> Modified:
>  trunk/ecore/src/lib/ecore/Ecore.h trunk/ecore/src/lib/ecore/ecore_exe.c
>
> Modified: trunk/ecore/src/lib/ecore/Ecore.h
> ===================================================================
> --- trunk/ecore/src/lib/ecore/Ecore.h   2011-10-07 17:47:55 UTC (rev
63914)
> +++ trunk/ecore/src/lib/ecore/Ecore.h   2011-10-07 23:37:42 UTC (rev
63915)
> @@ -654,7 +654,8 @@
>         ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered
automatically */
>         ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
>         ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */
> -        ECORE_EXE_NOT_LEADER = 256 /**< Do not use setsid() to have the
executed process be its own session leader */
> +        ECORE_EXE_NOT_LEADER = 256, /**< Do not use setsid() to have the
executed process be its own session leader */
> +        ECORE_EXE_TERM_WITH_PARENT = 512 /**< Makes child receive SIGTERM
when parent dies. */
>      };
>    typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
>
>
> Modified: trunk/ecore/src/lib/ecore/ecore_exe.c
> ===================================================================
> --- trunk/ecore/src/lib/ecore/ecore_exe.c       2011-10-07 17:47:55 UTC
(rev 63914)
> +++ trunk/ecore/src/lib/ecore/ecore_exe.c       2011-10-07 23:37:42 UTC
(rev 63915)
> @@ -14,6 +14,7 @@
>  #include <sys/types.h>
>  #include <unistd.h>
>  #include <fcntl.h>
> +#include <sys/prctl.h>
>
>  #ifdef HAVE_SYS_WAIT_H
>  # include <sys/wait.h>
> @@ -1509,6 +1510,11 @@
>           }
>      }
>
> +   if ((flags & ECORE_EXE_TERM_WITH_PARENT))
> +     {
> +        prctl(PR_SET_PDEATHSIG, SIGTERM);
> +     }
> +
>    if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
>    if ((flags & ECORE_EXE_USE_SH))
>      {
>
>
>
------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>

-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: barbi...@gmail.com
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to