aboutsummaryrefslogtreecommitdiff
path: root/tools/test/stress2/misc/reaper4.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/test/stress2/misc/reaper4.sh')
-rwxr-xr-xtools/test/stress2/misc/reaper4.sh13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/test/stress2/misc/reaper4.sh b/tools/test/stress2/misc/reaper4.sh
index bf400e396e63..0fdb3f75ccff 100755
--- a/tools/test/stress2/misc/reaper4.sh
+++ b/tools/test/stress2/misc/reaper4.sh
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2022 Peter Holm <pho@FreeBSD.org>
#
@@ -59,14 +59,13 @@ flip(void *ap, size_t len)
{
unsigned char *cp;
int byte;
- unsigned char bit, buf, mask, old __unused;
+ unsigned char bit, buf, mask;
cp = (unsigned char *)ap;
byte = random_long(0, len);
bit = random_long(0,7);
mask = ~(1 << bit);
buf = cp[byte];
- old = cp[byte];
buf = (buf & mask) | (~buf & ~mask);
cp[byte] = buf;
}
@@ -85,8 +84,9 @@ test(void) {
struct procctl_reaper_kill killemall;
pid_t pid;
time_t start;
- int data[20], e, n, m;
+ int data[20], debug, e, n, m;
+ debug = 0; /* set to 1 for debug output */
n = m = 0;
if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
err(EXIT_FAILURE, "Fail to acquire the reaper");
@@ -117,9 +117,8 @@ test(void) {
if (waitpid(pid, NULL, 0) != pid)
err(1, "waitpid()");
}
-#if defined(DEBUG)
- fprintf(stderr, "n = %d out of %d\n", n, m);
-#endif
+ if (debug == 1)
+ fprintf(stderr, "n = %d out of %d\n", n, m);
_exit(0);
}