[yocto] [ptest-runner][PATCH v2 2/4] use process groups when spawning
Randy MacLeod
Randy.MacLeod at windriver.com
Fri Jun 14 07:48:51 PDT 2019
From: Richard Purdie <richard.purdie at linuxfoundation.org>
Rather than just killing the process we've swawned, set the process group
for spawned children and then kill the group of processes.
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
Upstream-Status: Pending [code being tested]
---
utils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/utils.c b/utils.c
index 9fab6f2..86dcdad 100644
--- a/utils.c
+++ b/utils.c
@@ -330,7 +330,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
clock_gettime(clock, &time);
if ((time.tv_sec - sentinel.tv_sec) > timeout) {
*timeouted = 1;
- kill(pid, SIGKILL);
+ kill(-pid, SIGKILL);
waitflags = 0;
}
}
@@ -392,6 +392,7 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts,
rc = -1;
break;
} else if (child == 0) {
+ setsid();
run_child(p->run_ptest, pipefd_stdout[1], pipefd_stderr[1]);
} else {
int status;
--
2.17.0
More information about the yocto
mailing list