aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-06-25 07:46:45 +0000
committerUlrich Drepper <drepper@redhat.com>2003-06-25 07:46:45 +0000
commit6d0e6e844d591cfa9222b9a871ecba0560ad2ee1 (patch)
tree84e84275d4f0ea5b67c2c1dbeba045fb39761d24
parent7f8f7b9dc8a9709182574777bbe151388aa467bb (diff)
downloadglibc-6d0e6e844d591cfa9222b9a871ecba0560ad2ee1.tar
glibc-6d0e6e844d591cfa9222b9a871ecba0560ad2ee1.tar.gz
glibc-6d0e6e844d591cfa9222b9a871ecba0560ad2ee1.tar.bz2
glibc-6d0e6e844d591cfa9222b9a871ecba0560ad2ee1.zip
Update.
2003-06-19 Jakub Jelinek <jakub@redhat.com> * test-skeleton.c (timeout_handler): If waitpid returned 0, retry once after a second. If killed == 0, assume WTERMSIG (status) == SIGKILL.
-rw-r--r--ChangeLog6
-rw-r--r--test-skeleton.c17
2 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a0b11a62a..c48ded4a5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2003-06-19 Jakub Jelinek <jakub@redhat.com>
+
+ * test-skeleton.c (timeout_handler): If waitpid returned 0,
+ retry once after a second. If killed == 0, assume
+ WTERMSIG (status) == SIGKILL.
+
2003-06-18 Roland McGrath <roland@redhat.com>
* sysdeps/generic/dl-sysdep.c (_dl_show_auxv): Catch uninitialized
diff --git a/test-skeleton.c b/test-skeleton.c
index b9764285f0..1bffa69320 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -139,7 +139,20 @@ timeout_handler (int sig __attribute__ ((unused)))
kill (pid, SIGKILL);
/* Wait for it to terminate. */
- killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
+ int i;
+ for (i = 0; i < 5; ++i)
+ {
+ killed = waitpid (pid, &status, WNOHANG|WUNTRACED);
+ if (killed != 0)
+ break;
+
+ /* Delay, give the system time to process the kill. If the
+ nanosleep() call return prematurely, all the better. We
+ won't restart it since this probably means the child process
+ finally died. */
+ struct timespec ts = { .tv_sec = 0, .tv_nsec = 100000000 };
+ nanosleep (&ts, NULL);
+ }
if (killed != 0 && killed != pid)
{
perror ("Failed to killed test process");
@@ -156,7 +169,7 @@ timeout_handler (int sig __attribute__ ((unused)))
exit (0);
#endif
- if (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL)
+ if (killed == 0 || (WIFSIGNALED (status) && WTERMSIG (status) == SIGKILL))
fputs ("Timed out: killed the child process\n", stderr);
else if (WIFSTOPPED (status))
fprintf (stderr, "Timed out: the child process was %s\n",