summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2018-01-24 00:32:02 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2018-01-24 00:32:02 +0000
commite5b36b7080fae8b353ee53caaf815c0c44bdd271 (patch)
tree029c2cf0d64fe9ec04bc40611476d64987c3743c /tests
parentd2ff0c26cca58a6134bab4da0f3c30856b06428a (diff)
Notes
Diffstat (limited to 'tests')
-rw-r--r--tests/sys/kern/ptrace_test.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c
index 167a94feb8da..d7b3222523dd 100644
--- a/tests/sys/kern/ptrace_test.c
+++ b/tests/sys/kern/ptrace_test.c
@@ -104,6 +104,10 @@ wait_for_zombie(pid_t pid)
/*
* Wait for a process to exit. This is kind of gross, but
* there is not a better way.
+ *
+ * Prior to r325719, the kern.proc.pid.<pid> sysctl failed
+ * with ESRCH. After that change, a valid struct kinfo_proc
+ * is returned for zombies with ki_stat set to SZOMB.
*/
for (;;) {
struct kinfo_proc kp;
@@ -116,10 +120,11 @@ wait_for_zombie(pid_t pid)
mib[3] = pid;
len = sizeof(kp);
if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) {
- /* The KERN_PROC_PID sysctl fails for zombies. */
ATF_REQUIRE(errno == ESRCH);
break;
}
+ if (kp.ki_stat == SZOMB)
+ break;
usleep(5000);
}
}