summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch')
-rw-r--r--meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch b/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch
new file mode 100644
index 0000000000..5436a3340c
--- /dev/null
+++ b/meta/recipes-support/ptest-runner/ptest-runner/0002-use-process-groups-when-spawning.patch
@@ -0,0 +1,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;