rteval-loads/SOURCES/0010-core-shim-rework-waitp...

39 lines
1.0 KiB
Diff

From 97aaa339ed3cfa22e73f2dcbd0bac26b00f3a0e3 Mon Sep 17 00:00:00 2001
From: Colin Ian King <colin.king@canonical.com>
Date: Tue, 19 May 2020 09:19:04 +0100
Subject: [PATCH 10/28] core-shim: rework waitpid again, terminate child on
EINTR (LP: #1879447)
The parent may receive a EINTR on a SIGALRM so send this to the
child. If it hasn't died after a while send the child SIGKILL
to force termination.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
core-shim.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/core-shim.c b/core-shim.c
index a44f6cf1b923..62c00ec991ef 100644
--- a/core-shim.c
+++ b/core-shim.c
@@ -1188,10 +1188,11 @@ pid_t shim_waitpid(pid_t pid, int *wstatus, int options)
* Retry if EINTR unless we've have 100
* consecutive EINTRs then give up.
*/
- if (!keep_stressing_flag())
- break;
- if (count++ > 100)
- break;
+ if (!keep_stressing_flag()) {
+ kill(pid, SIGALRM);
+ if (count++ > 100)
+ kill(pid, SIGKILL);
+ }
}
return ret;
}
--
2.21.3