ecore_exe/efl_exe - implement exit with parent on bsds with procctl

devs/bu5hm4n/work_seperator
Carsten Haitzler 3 years ago
parent 77db0820e3
commit 72a8a2ce40
  1. 1
      header_checks/meson.build
  2. 8
      src/lib/ecore/ecore_exe_posix.c
  3. 12
      src/lib/ecore/efl_exe.c

@ -97,6 +97,7 @@ function_checks = [
['mmap', ['sys/mman.h']],
['mtrace', ['mcheck.h']],
['prctl', ['sys/prctl.h']],
['procctl', ['sys/procctl.h']],
['realpath', ['stdlib.h']],
['setxattr', ['sys/types.h', 'sys/xattr.h']],
['siglongjmp', ['setjmp.h']],

@ -16,6 +16,8 @@
#ifdef HAVE_PRCTL
# include <sys/prctl.h>
#elif defined(HAVE_PROCCTL)
# include <sys/procctl.h>
#endif
#ifdef HAVE_SYS_WAIT_H
@ -1000,6 +1002,12 @@ _ecore_exe_exec_it(const char *exe_cmd,
{
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
if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();

@ -25,8 +25,10 @@
# include <sys/socket.h>
# ifdef HAVE_PRCTL
# include <sys/prctl.h>
# elif defined(HAVE_PROCCTL)
# include <sys/procctl.h>
# endif
# ifdef HAVE_SYS_WAIT_H
#ifdef HAVE_SYS_WAIT_H
# include <sys/wait.h>
# endif
# ifndef HAVE_CLEARENV
@ -150,7 +152,13 @@ _exec(const char *cmd, Efl_Exe_Flags flags, Efl_Task_Flags task_flags)
# ifdef HAVE_PRCTL
if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT)
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 (use_sh) // We have to use a shell to run this.

Loading…
Cancel
Save