forked from enlightenment/efl
ecore_exe/efl_exe - implement exit with parent on bsds with procctl
This commit is contained in:
parent
77db0820e3
commit
72a8a2ce40
|
@ -97,6 +97,7 @@ function_checks = [
|
||||||
['mmap', ['sys/mman.h']],
|
['mmap', ['sys/mman.h']],
|
||||||
['mtrace', ['mcheck.h']],
|
['mtrace', ['mcheck.h']],
|
||||||
['prctl', ['sys/prctl.h']],
|
['prctl', ['sys/prctl.h']],
|
||||||
|
['procctl', ['sys/procctl.h']],
|
||||||
['realpath', ['stdlib.h']],
|
['realpath', ['stdlib.h']],
|
||||||
['setxattr', ['sys/types.h', 'sys/xattr.h']],
|
['setxattr', ['sys/types.h', 'sys/xattr.h']],
|
||||||
['siglongjmp', ['setjmp.h']],
|
['siglongjmp', ['setjmp.h']],
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
#ifdef HAVE_PRCTL
|
#ifdef HAVE_PRCTL
|
||||||
# include <sys/prctl.h>
|
# include <sys/prctl.h>
|
||||||
|
#elif defined(HAVE_PROCCTL)
|
||||||
|
# include <sys/procctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
|
@ -1000,6 +1002,12 @@ _ecore_exe_exec_it(const char *exe_cmd,
|
||||||
{
|
{
|
||||||
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
||||||
}
|
}
|
||||||
|
#elif defined(HAVE_PROCCTL)
|
||||||
|
if ((flags & ECORE_EXE_TERM_WITH_PARENT))
|
||||||
|
{
|
||||||
|
int sig = SIGTERM;
|
||||||
|
procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &sig);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
|
if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
# include <sys/socket.h>
|
# include <sys/socket.h>
|
||||||
# ifdef HAVE_PRCTL
|
# ifdef HAVE_PRCTL
|
||||||
# include <sys/prctl.h>
|
# include <sys/prctl.h>
|
||||||
|
# elif defined(HAVE_PROCCTL)
|
||||||
|
# include <sys/procctl.h>
|
||||||
# endif
|
# endif
|
||||||
# ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
# include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
# endif
|
# endif
|
||||||
# ifndef HAVE_CLEARENV
|
# ifndef HAVE_CLEARENV
|
||||||
|
@ -150,7 +152,13 @@ _exec(const char *cmd, Efl_Exe_Flags flags, Efl_Task_Flags task_flags)
|
||||||
# ifdef HAVE_PRCTL
|
# ifdef HAVE_PRCTL
|
||||||
if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT)
|
if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT)
|
||||||
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
prctl(PR_SET_PDEATHSIG, SIGTERM);
|
||||||
# endif
|
#elif defined(HAVE_PROCCTL)
|
||||||
|
if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT)
|
||||||
|
{
|
||||||
|
int sig = SIGTERM;
|
||||||
|
procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &sig);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (flags & EFL_EXE_FLAGS_GROUP_LEADER) setsid();
|
if (flags & EFL_EXE_FLAGS_GROUP_LEADER) setsid();
|
||||||
if (use_sh) // We have to use a shell to run this.
|
if (use_sh) // We have to use a shell to run this.
|
||||||
|
|
Loading…
Reference in New Issue