aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Holm <pho@FreeBSD.org>2023-06-08 07:49:52 +0000
committerPeter Holm <pho@FreeBSD.org>2023-06-08 07:49:52 +0000
commit6b7a06c3bdbc17bc5ac450023bd0baadfaeefa78 (patch)
tree1139e20f6f846133d45f1dba65286fa81da3413b
parent267411d164d4d38a701599e3afe8d9e9261f65dd (diff)
downloadsrc-6b7a06c3bdbc17bc5ac450023bd0baadfaeefa78.tar.gz
src-6b7a06c3bdbc17bc5ac450023bd0baadfaeefa78.zip
stress2: Avoid using "__unused"
-rwxr-xr-xtools/test/stress2/misc/reaper2.sh8
-rwxr-xr-xtools/test/stress2/misc/reaper3.sh11
-rwxr-xr-xtools/test/stress2/misc/reaper4.sh11
3 files changed, 14 insertions, 16 deletions
diff --git a/tools/test/stress2/misc/reaper2.sh b/tools/test/stress2/misc/reaper2.sh
index 1643e9985240..ee9cf927f1d9 100755
--- a/tools/test/stress2/misc/reaper2.sh
+++ b/tools/test/stress2/misc/reaper2.sh
@@ -65,8 +65,9 @@ test(void) {
struct procctl_reaper_kill killemall;
pid_t pid;
time_t start;
- int data[20], e, n __unused, 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");
@@ -94,9 +95,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);
}
diff --git a/tools/test/stress2/misc/reaper3.sh b/tools/test/stress2/misc/reaper3.sh
index 90bb395da5c1..59012d2c45ca 100755
--- a/tools/test/stress2/misc/reaper3.sh
+++ b/tools/test/stress2/misc/reaper3.sh
@@ -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;
}
@@ -86,8 +85,9 @@ test(void) {
struct procctl_reaper_kill killemall;
pid_t pid;
time_t start;
- int data[20], e, n __unused, 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");
@@ -118,9 +118,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);
}
diff --git a/tools/test/stress2/misc/reaper4.sh b/tools/test/stress2/misc/reaper4.sh
index bd30bd1b0efd..0fdb3f75ccff 100755
--- a/tools/test/stress2/misc/reaper4.sh
+++ b/tools/test/stress2/misc/reaper4.sh
@@ -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 __unused, 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);
}