summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@kernel.org>2022-05-02 18:24:56 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-18 12:04:51 +0200
commit68fecac7d81b915d27b9dbb677e3ac54456fcf1a (patch)
tree0b272999224d30930f4f1b09eb2085f325cb7776
parent31d3b9913d718ba949a258bd02045aed2af5fd76 (diff)
lib/igt_core: export kill_children() function
This function is needed outside igt_core. So, make it exportable, and allow passing different signs to the children. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r--lib/igt_core.c12
-rw-r--r--lib/igt_core.h1
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index ba906ab0..b7116f4e 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -2028,11 +2028,11 @@ void __igt_fail_assert(const char *domain, const char *file, const int line,
igt_fail(IGT_EXIT_FAILURE);
}
-static void kill_children(void)
+void igt_kill_children(int signal)
{
for (int c = 0; c < num_test_children; c++) {
if (test_children[c] > 0)
- kill(test_children[c], SIGKILL);
+ kill(test_children[c], signal);
}
}
@@ -2060,7 +2060,7 @@ void __igt_abort(const char *domain, const char *file, const int line,
}
/* just try our best, we are aborting the execution anyway */
- kill_children();
+ igt_kill_children(SIGKILL);
print_backtrace();
@@ -2124,7 +2124,7 @@ void igt_exit(void)
command_str, igt_exitcode);
igt_debug("Exiting with status code %d\n", igt_exitcode);
- kill_children();
+ igt_kill_children(SIGKILL);
assert(!num_test_children);
assert(waitpid(-1, &tmp, WNOHANG) == -1 && errno == ECHILD);
@@ -2390,7 +2390,7 @@ int __igt_waitchildren(void)
err = 256;
}
- kill_children();
+ igt_kill_children(SIGKILL);
}
count++;
@@ -2424,7 +2424,7 @@ static void igt_alarm_killchildren(int signal)
{
igt_info("Timed out waiting for children\n");
- kill_children();
+ igt_kill_children(SIGKILL);
}
/**
diff --git a/lib/igt_core.h b/lib/igt_core.h
index 78dc6202..526282fa 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -1103,6 +1103,7 @@ bool __igt_fork(void);
int __igt_waitchildren(void);
void igt_waitchildren(void);
void igt_waitchildren_timeout(int seconds, const char *reason);
+void igt_kill_children(int signal);
/**
* igt_helper_process: