stress2: Fix warning about unused variable. Remove debug "date"

This commit is contained in:
Peter Holm 2024-08-16 09:19:51 +02:00
parent 3d89acf590
commit 41e03b46da
2 changed files with 4 additions and 6 deletions

View file

@ -56,6 +56,7 @@ cat > /tmp/$prog.c <<EOF
#include <fcntl.h>
#include <libutil.h>
#include <pthread.h>
#include <pthread_np.h>
#include <pwd.h>
#include <signal.h>
#include <stdio.h>
@ -92,10 +93,9 @@ static void *
calls(void *arg __unused)
{
time_t start;
int i;
start = time(NULL);
for (i = 0; time(NULL) - start < 10; i++) {
while (time(NULL) - start < 10) {
arc4random_buf(r, sizeof(r));
alarm(1);
syscall(SYS_sigreturn, r);
@ -176,7 +176,6 @@ cc -o $prog -Wall -Wextra -O0 $prog.c -lpthread || exit 1
start=`date +%s`
while [ $((`date +%s` - start)) -lt 300 ]; do
./$prog > /dev/null 2>&1
date +%T
done
rm -f /tmp/$prog /tmp/$ptog.c /tmp/$prog.core
exit 0

View file

@ -110,10 +110,10 @@ calls(void *arg __unused)
{
time_t start;
ucontext_t uc;
int i, n;
int n;
start = time(NULL);
for (i = 0; time(NULL) - start < 10; i++) {
while (time(NULL) - start < 10) {
n = 0;
if (getcontext(&uc) == -1)
err(1, "getcontext");
@ -202,7 +202,6 @@ cc -o $prog -Wall -Wextra -O0 $prog.c -lpthread || exit 1
start=`date +%s`
while [ $((`date +%s` - start)) -lt 300 ]; do
./$prog > /dev/null 2>&1
date +%T
done
rm -f /tmp/$prog /tmp/$ptog.c /tmp/$prog.core
exit 0