Module Name:    src
Committed By:   kamil
Date:           Tue Mar 13 13:34:40 UTC 2018

Modified Files:
        src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Add a new function in ATF t_ptrace_wait*: await_zombie_raw()

Add await_zombie_raw() that is the same as await_zombie(), whith an
addition of additional "useconds_t ms" parameter indicating delays between
new polling for a zombie process.

This new function will be used for testing a race condition that has been
observed occassionally crashing a test case -- returning duplicate entries
for KERN_PROC_PID.

Sponsored by <The NetBSD Foundation>


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_ptrace_wait.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.1 src/tests/lib/libc/sys/t_ptrace_wait.h:1.2
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.1	Sun Apr  2 21:44:00 2017
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Tue Mar 13 13:34:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.1 2017/04/02 21:44:00 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.2 2018/03/13 13:34:40 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -328,7 +328,7 @@ forkee_status_stopped(int status, int ex
 
 /* This function is currently designed to be run in the main/parent process */
 static void __used
-await_zombie(pid_t process)
+await_zombie_raw(pid_t process, useconds_t ms)
 {
 	struct kinfo_proc2 p;
 	size_t len = sizeof(p);
@@ -351,10 +351,19 @@ await_zombie(pid_t process)
 		if (p.p_stat == LSZOMB)
 			break;
 
-		ATF_REQUIRE(usleep(1000) == 0);
+		if (ms > 0) {
+			ATF_REQUIRE(usleep(ms) == 0);
+		}
 	}
 }
 
+static void __used
+await_zombie(pid_t process)
+{
+
+	await_zombie_raw(process, 1000);
+}
+
 /* Happy number sequence -- this function is used to just consume cpu cycles */
 #define	HAPPY_NUMBER	1
 

Reply via email to