summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-01-15 02:35:11 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-01-15 12:14:31 +0000
commit72a8a2ce40ee9913c676f922551f65ca3cdd0e3b (patch)
tree3a255ffbb5b9cea0794d8c1e726c3dbb2071b307
parent77db0820e37b5a2b2f66562a00b8c689b5f2c022 (diff)
ecore_exe/efl_exe - implement exit with parent on bsds with procctl
-rw-r--r--header_checks/meson.build1
-rw-r--r--src/lib/ecore/ecore_exe_posix.c8
-rw-r--r--src/lib/ecore/efl_exe.c12
3 files changed, 19 insertions, 2 deletions
diff --git a/header_checks/meson.build b/header_checks/meson.build
index 3aaf3776c6..1d3f0e171f 100644
--- a/header_checks/meson.build
+++ b/header_checks/meson.build
@@ -97,6 +97,7 @@ function_checks = [
97 ['mmap', ['sys/mman.h']], 97 ['mmap', ['sys/mman.h']],
98 ['mtrace', ['mcheck.h']], 98 ['mtrace', ['mcheck.h']],
99 ['prctl', ['sys/prctl.h']], 99 ['prctl', ['sys/prctl.h']],
100 ['procctl', ['sys/procctl.h']],
100 ['realpath', ['stdlib.h']], 101 ['realpath', ['stdlib.h']],
101 ['setxattr', ['sys/types.h', 'sys/xattr.h']], 102 ['setxattr', ['sys/types.h', 'sys/xattr.h']],
102 ['siglongjmp', ['setjmp.h']], 103 ['siglongjmp', ['setjmp.h']],
diff --git a/src/lib/ecore/ecore_exe_posix.c b/src/lib/ecore/ecore_exe_posix.c
index 44d9c73ca8..07f1058ab0 100644
--- a/src/lib/ecore/ecore_exe_posix.c
+++ b/src/lib/ecore/ecore_exe_posix.c
@@ -16,6 +16,8 @@
16 16
17#ifdef HAVE_PRCTL 17#ifdef HAVE_PRCTL
18# include <sys/prctl.h> 18# include <sys/prctl.h>
19#elif defined(HAVE_PROCCTL)
20# include <sys/procctl.h>
19#endif 21#endif
20 22
21#ifdef HAVE_SYS_WAIT_H 23#ifdef HAVE_SYS_WAIT_H
@@ -1000,6 +1002,12 @@ _ecore_exe_exec_it(const char *exe_cmd,
1000 { 1002 {
1001 prctl(PR_SET_PDEATHSIG, SIGTERM); 1003 prctl(PR_SET_PDEATHSIG, SIGTERM);
1002 } 1004 }
1005#elif defined(HAVE_PROCCTL)
1006 if ((flags & ECORE_EXE_TERM_WITH_PARENT))
1007 {
1008 int sig = SIGTERM;
1009 procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &sig);
1010 }
1003#endif 1011#endif
1004 1012
1005 if (!(flags & ECORE_EXE_NOT_LEADER)) setsid(); 1013 if (!(flags & ECORE_EXE_NOT_LEADER)) setsid();
diff --git a/src/lib/ecore/efl_exe.c b/src/lib/ecore/efl_exe.c
index 8609dbfac5..b2c6341523 100644
--- a/src/lib/ecore/efl_exe.c
+++ b/src/lib/ecore/efl_exe.c
@@ -25,8 +25,10 @@
25# include <sys/socket.h> 25# include <sys/socket.h>
26# ifdef HAVE_PRCTL 26# ifdef HAVE_PRCTL
27# include <sys/prctl.h> 27# include <sys/prctl.h>
28# elif defined(HAVE_PROCCTL)
29# include <sys/procctl.h>
28# endif 30# endif
29# ifdef HAVE_SYS_WAIT_H 31#ifdef HAVE_SYS_WAIT_H
30# include <sys/wait.h> 32# include <sys/wait.h>
31# endif 33# endif
32# ifndef HAVE_CLEARENV 34# ifndef HAVE_CLEARENV
@@ -150,7 +152,13 @@ _exec(const char *cmd, Efl_Exe_Flags flags, Efl_Task_Flags task_flags)
150# ifdef HAVE_PRCTL 152# ifdef HAVE_PRCTL
151 if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT) 153 if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT)
152 prctl(PR_SET_PDEATHSIG, SIGTERM); 154 prctl(PR_SET_PDEATHSIG, SIGTERM);
153# endif 155#elif defined(HAVE_PROCCTL)
156 if (task_flags & EFL_TASK_FLAGS_EXIT_WITH_PARENT)
157 {
158 int sig = SIGTERM;
159 procctl(P_PID, 0, PROC_PDEATHSIG_CTL, &sig);
160 }
161#endif
154 162
155 if (flags & EFL_EXE_FLAGS_GROUP_LEADER) setsid(); 163 if (flags & EFL_EXE_FLAGS_GROUP_LEADER) setsid();
156 if (use_sh) // We have to use a shell to run this. 164 if (use_sh) // We have to use a shell to run this.