1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
From f0c42a65633341ad048718c7a6dbd035818e9eaf Mon Sep 17 00:00:00 2001
From: Richard Purdie <richard.purdie@linuxfoundation.org>
Date: Thu, 4 Apr 2019 14:20:31 +0100
Subject: [PATCH 2/3] use process groups when spawning
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@linuxfoundation.org>
Upstream-Status: Pending [code being tested]
---
utils.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/utils.c b/utils.c
index 3ceb342..c5b3b8d 100644
--- a/utils.c
+++ b/utils.c
@@ -309,7 +309,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;
}
}
@@ -371,6 +371,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;
|