blob: 5436a3340c42eb2fc0cd7ce71a5094ff15110a58 [file] [log] [blame]
Brad Bishopd89cb5f2019-04-10 09:02:41 -04001From f0c42a65633341ad048718c7a6dbd035818e9eaf Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 4 Apr 2019 14:20:31 +0100
4Subject: [PATCH 2/3] use process groups when spawning
5
6Rather than just killing the process we've swawned, set the process group
7for spawned children and then kill the group of processes.
8
9Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
10Upstream-Status: Pending [code being tested]
11---
12 utils.c | 9 +++++----
13 1 file changed, 5 insertions(+), 4 deletions(-)
14
15diff --git a/utils.c b/utils.c
16index 3ceb342..c5b3b8d 100644
17--- a/utils.c
18+++ b/utils.c
19@@ -309,7 +309,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, pid_t pid,
20 clock_gettime(clock, &time);
21 if ((time.tv_sec - sentinel.tv_sec) > timeout) {
22 *timeouted = 1;
23- kill(pid, SIGKILL);
24+ kill(-pid, SIGKILL);
25 waitflags = 0;
26 }
27 }
28@@ -371,6 +371,7 @@ run_ptests(struct ptest_list *head, const struct ptest_options opts,
29 rc = -1;
30 break;
31 } else if (child == 0) {
32+ setsid();
33 run_child(p->run_ptest, pipefd_stdout[1], pipefd_stderr[1]);
34 } else {
35 int status;