git: 8d72c409cd85 - main - stress2: Fix "set but not used [-Wunused-but-set-variable]" warnings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 03 Feb 2022 10:53:15 UTC
The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=8d72c409cd8591e600758d4be5396bb9038db907 commit 8d72c409cd8591e600758d4be5396bb9038db907 Author: Peter Holm <pho@FreeBSD.org> AuthorDate: 2022-02-03 10:52:38 +0000 Commit: Peter Holm <pho@FreeBSD.org> CommitDate: 2022-02-03 10:52:38 +0000 stress2: Fix "set but not used [-Wunused-but-set-variable]" warnings --- tools/test/stress2/misc/contigmalloc3.sh | 3 +-- tools/test/stress2/misc/core4.sh | 4 +--- tools/test/stress2/misc/datagram.sh | 4 ++-- tools/test/stress2/misc/fcntl.sh | 2 +- tools/test/stress2/misc/fifo.sh | 5 ++--- tools/test/stress2/misc/fifo2.sh | 3 +-- tools/test/stress2/misc/flock_open_close.sh | 3 +-- tools/test/stress2/misc/fsgs.sh | 2 +- tools/test/stress2/misc/fullpath.sh | 2 -- tools/test/stress2/misc/kinfo3.sh | 4 ++-- tools/test/stress2/misc/largepage.sh | 2 +- tools/test/stress2/misc/lstat.sh | 4 +--- tools/test/stress2/misc/mmap22.sh | 4 ++-- tools/test/stress2/misc/mmap27.sh | 2 +- tools/test/stress2/misc/mmap28.sh | 2 +- tools/test/stress2/misc/mmap7.sh | 4 ++-- tools/test/stress2/misc/mprotect.sh | 4 ++-- tools/test/stress2/misc/nullfs22.sh | 2 +- tools/test/stress2/misc/sendfile.sh | 4 ++-- tools/test/stress2/misc/sendfile10.sh | 2 +- tools/test/stress2/misc/sendfile11.sh | 4 ++-- tools/test/stress2/misc/sendfile12.sh | 4 ++-- tools/test/stress2/misc/sendfile13.sh | 2 +- tools/test/stress2/misc/sendfile14.sh | 2 +- tools/test/stress2/misc/sendfile2.sh | 2 +- tools/test/stress2/misc/sendfile21.sh | 2 +- tools/test/stress2/misc/sendfile24.sh | 4 +--- tools/test/stress2/misc/sendfile3.sh | 4 +--- tools/test/stress2/misc/sendfile8.sh | 4 +--- tools/test/stress2/misc/sendfile9.sh | 4 +--- tools/test/stress2/misc/setsockopt2.sh | 2 +- tools/test/stress2/misc/shm2.sh | 3 +-- tools/test/stress2/misc/tcp3.sh | 4 +--- tools/test/stress2/misc/tcp4.sh | 4 +--- tools/test/stress2/tools/bench.c | 6 +++--- 35 files changed, 45 insertions(+), 68 deletions(-) diff --git a/tools/test/stress2/misc/contigmalloc3.sh b/tools/test/stress2/misc/contigmalloc3.sh index 9497a67f21cf..9baf7c129688 100755 --- a/tools/test/stress2/misc/contigmalloc3.sh +++ b/tools/test/stress2/misc/contigmalloc3.sh @@ -62,7 +62,7 @@ void test(int argc, char *argv[]) { long mw, size; - int i, no, ps, res; + int no, ps, res; char *cp; if (argc == 3) { @@ -77,7 +77,6 @@ test(int argc, char *argv[]) fprintf(stderr, "max_user_wired too small for this test\n"); exit (0); } - i = 0; size = round_page(MAXBUF); res = syscall(no, TALLOC, &cp, &size); if (res == -1) { diff --git a/tools/test/stress2/misc/core4.sh b/tools/test/stress2/misc/core4.sh index 562160a1a314..e77b5176c261 100755 --- a/tools/test/stress2/misc/core4.sh +++ b/tools/test/stress2/misc/core4.sh @@ -79,9 +79,7 @@ EOF int main(void) { - void *p; - - p = mmap(NULL, SIZ, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); + (void)mmap(NULL, SIZ, PROT_READ | PROT_WRITE, MAP_ANON, -1, 0); usleep(1000); raise(SIGSEGV); diff --git a/tools/test/stress2/misc/datagram.sh b/tools/test/stress2/misc/datagram.sh index 895145a22c84..5a5715886a88 100755 --- a/tools/test/stress2/misc/datagram.sh +++ b/tools/test/stress2/misc/datagram.sh @@ -59,7 +59,7 @@ int main(void) { struct sockaddr_un addr; - int bytes, sockfd; + int sockfd; char buf[1024]; unlink(filename); @@ -78,7 +78,7 @@ main(void) { sizeof(addr)) == -1) err(1, "connect"); - bytes = read(sockfd, buf, sizeof(buf)); + (void)read(sockfd, buf, sizeof(buf)); return (0); } diff --git a/tools/test/stress2/misc/fcntl.sh b/tools/test/stress2/misc/fcntl.sh index ccbcc45a325f..39f7f87dc005 100755 --- a/tools/test/stress2/misc/fcntl.sh +++ b/tools/test/stress2/misc/fcntl.sh @@ -80,7 +80,7 @@ add(int n, int increment) { struct flock fl; off_t pos; - long val, oval; + long val, oval __unused; int r; pos = n * sizeof(val); diff --git a/tools/test/stress2/misc/fifo.sh b/tools/test/stress2/misc/fifo.sh index 17881bd9eb00..662f09d5d2dc 100755 --- a/tools/test/stress2/misc/fifo.sh +++ b/tools/test/stress2/misc/fifo.sh @@ -75,13 +75,12 @@ EOF int main(void) { - int fd; if (mkfifo("fifo", 0644) == -1) err(1, "mkfifo"); - fd = open("fifo", O_RDWR | O_SHLOCK | O_EXLOCK); - fd = open("fifo", 0x60e9f2, 0xc74c65b1db4be370, 0xb64a34df72368759); + (void)open("fifo", O_RDWR | O_SHLOCK | O_EXLOCK); + (void)open("fifo", 0x60e9f2, 0xc74c65b1db4be370, 0xb64a34df72368759); return (0); } diff --git a/tools/test/stress2/misc/fifo2.sh b/tools/test/stress2/misc/fifo2.sh index 7f269f2368d4..7d32ce063908 100755 --- a/tools/test/stress2/misc/fifo2.sh +++ b/tools/test/stress2/misc/fifo2.sh @@ -133,7 +133,7 @@ static void * calls(void *arg __unused) { unsigned long arg1, arg2, arg3, arg4, arg5, arg6, arg7; - int i, num; + int i; for (i = 0;; i++) { arg1 = (unsigned long)(void *)"f"; @@ -151,7 +151,6 @@ calls(void *arg __unused) #endif alarm(1); syscall(SYS_open, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - num = 0; } return (0); diff --git a/tools/test/stress2/misc/flock_open_close.sh b/tools/test/stress2/misc/flock_open_close.sh index 173cdcbf2e75..2b70d41aa4f8 100755 --- a/tools/test/stress2/misc/flock_open_close.sh +++ b/tools/test/stress2/misc/flock_open_close.sh @@ -124,9 +124,8 @@ child(const char *binary) static void exec_child(char **av) { - int fd; - fd = open(av[0], O_RDONLY | O_SHLOCK); + (void)open(av[0], O_RDONLY | O_SHLOCK); execv(av[0], av); /* "flock_open_close: execv(/mnt/test): Text file busy" seen */ err(127, "execv(%s)", av[0]); diff --git a/tools/test/stress2/misc/fsgs.sh b/tools/test/stress2/misc/fsgs.sh index ba9e81de392d..ff6a1161968e 100755 --- a/tools/test/stress2/misc/fsgs.sh +++ b/tools/test/stress2/misc/fsgs.sh @@ -88,7 +88,7 @@ test(void) for (i = 0; i < 100; i++) { if ((pid = fork()) == 0) { cp = malloc(2); - _exit(0); + _exit(cp == NULL); } if (waitpid(pid, &status, 0) != pid) err(1, "waitpid(%d)", pid); diff --git a/tools/test/stress2/misc/fullpath.sh b/tools/test/stress2/misc/fullpath.sh index 88cee4795009..5e772f00fa7d 100755 --- a/tools/test/stress2/misc/fullpath.sh +++ b/tools/test/stress2/misc/fullpath.sh @@ -101,9 +101,7 @@ test(void) { int main(int argc, char **argv) { - int i; - i = 0; signal(SIGALRM, handler); alarm(60); diff --git a/tools/test/stress2/misc/kinfo3.sh b/tools/test/stress2/misc/kinfo3.sh index 9f4d00dbf2fb..262a9943e780 100755 --- a/tools/test/stress2/misc/kinfo3.sh +++ b/tools/test/stress2/misc/kinfo3.sh @@ -35,7 +35,7 @@ odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > kinfo3.c -mycc -o kinfo3 -Wall -Wextra kinfo3.c -lutil -pthread || exit 1 +mycc -o kinfo3 -Wall -Wextra -O0 kinfo3.c -lutil -pthread || exit 1 rm -f kinfo3.c s=0 @@ -131,7 +131,7 @@ list(void) { struct kinfo_proc *kipp; struct kinfo_vmentry *freep_vm; - struct kinfo_file *freep, *kif; + struct kinfo_file *freep, *kif __unused; size_t len; long i, j; int cnt, name[4]; diff --git a/tools/test/stress2/misc/largepage.sh b/tools/test/stress2/misc/largepage.sh index 3c8e745ff3ab..7e492de748fa 100755 --- a/tools/test/stress2/misc/largepage.sh +++ b/tools/test/stress2/misc/largepage.sh @@ -78,7 +78,7 @@ work(int idx) size_t len; int i,r; char *p; - volatile char val; + volatile char val __unused; char path[PATH_MAX]; len = ps[idx]; diff --git a/tools/test/stress2/misc/lstat.sh b/tools/test/stress2/misc/lstat.sh index f89886a4556e..a82692979cbe 100755 --- a/tools/test/stress2/misc/lstat.sh +++ b/tools/test/stress2/misc/lstat.sh @@ -129,7 +129,7 @@ test(int idx) struct stat sb; pid_t fpid, pd, pid; size_t len; - int i, n, r; + int i, r; char dir[128], path[128]; atomic_add_int(&share[R1], 1); @@ -156,7 +156,6 @@ test(int idx) while (share[R2] == 0) { snprintf(path, sizeof(path), "%s/d.%d.%d", arg, pid, i); - n = 0; while (dirs[0] > MXDIRS && share[R2] == 0) usleep(SLPTIME); while ((r = mkdir(path, 0777)) == -1) { @@ -179,7 +178,6 @@ test(int idx) i = 0; setproctitle("rmdir"); while (dirs[0] > 0 || share[R2] == 0) { - n = 0; if (dirs[0] < MXDIRS / 2) usleep(SLPTIME); snprintf(path, sizeof(path), "%s/d.%d.%d", arg, pid, i); diff --git a/tools/test/stress2/misc/mmap22.sh b/tools/test/stress2/misc/mmap22.sh index 4b730100d7dc..6d56dbf4393e 100755 --- a/tools/test/stress2/misc/mmap22.sh +++ b/tools/test/stress2/misc/mmap22.sh @@ -41,7 +41,7 @@ here=`pwd` cd /tmp sed '1,/^EOF/d' < $here/$0 > mmap22.c -mycc -o mmap22 -Wall -Wextra -O2 -g mmap22.c -lpthread || exit 1 +mycc -o mmap22 -Wall -Wextra -O0 -g mmap22.c -lpthread || exit 1 rm -f mmap22.c su $testuser -c /tmp/mmap22 & @@ -78,7 +78,7 @@ void * tmmap(void *arg __unused) { size_t len; - void *p; + void *p __unused; int i; len = SIZ; diff --git a/tools/test/stress2/misc/mmap27.sh b/tools/test/stress2/misc/mmap27.sh index 7f8d4e94583a..469a8a9ad8d8 100755 --- a/tools/test/stress2/misc/mmap27.sh +++ b/tools/test/stress2/misc/mmap27.sh @@ -76,7 +76,7 @@ work(void) size_t left, len; int i; char *p; - volatile char val; + volatile char val __unused; if ((fd = open("/dev/mem", O_RDWR)) == -1) err(1,"open()"); diff --git a/tools/test/stress2/misc/mmap28.sh b/tools/test/stress2/misc/mmap28.sh index fd64202e3814..9e4fc6d26d5d 100755 --- a/tools/test/stress2/misc/mmap28.sh +++ b/tools/test/stress2/misc/mmap28.sh @@ -78,7 +78,7 @@ work(void) int i; char *p; char path[128]; - volatile char val; + volatile char val __unused; if ((rfd = open("/dev/random", O_RDONLY)) == -1) err(1, "open(/dev/random)"); diff --git a/tools/test/stress2/misc/mmap7.sh b/tools/test/stress2/misc/mmap7.sh index 7d467c715203..ee802a85e933 100755 --- a/tools/test/stress2/misc/mmap7.sh +++ b/tools/test/stress2/misc/mmap7.sh @@ -38,7 +38,7 @@ dir=/tmp odir=`pwd` cd $dir sed '1,/^EOF/d' < $odir/$0 > $dir/wire_no_page.c -mycc -o mmap7 -Wall -Wextra wire_no_page.c -lpthread || exit 1 +mycc -o mmap7 -Wall -Wextra -O0 wire_no_page.c -lpthread || exit 1 rm -f wire_no_page.c cd $odir @@ -75,7 +75,7 @@ struct stat st; void * test2(void *arg __unused) { - int error, i; + int error, i __unused; p1[arc4random() % len] = 1; p2[arc4random() % len] = 1; diff --git a/tools/test/stress2/misc/mprotect.sh b/tools/test/stress2/misc/mprotect.sh index 9fde68de56ec..e3e6e765c331 100755 --- a/tools/test/stress2/misc/mprotect.sh +++ b/tools/test/stress2/misc/mprotect.sh @@ -43,7 +43,7 @@ cat > mprotect.c <<EOF int main(void) { - char *addr, c; + char *addr, c __unused; size_t i, len; len = 2 * 1024 * 1024; @@ -67,7 +67,7 @@ main(void) return (0); } EOF -mycc -o mprotect -Wall -Wextra -O2 mprotect.c || exit 1 +mycc -o mprotect -Wall -Wextra -O0 mprotect.c || exit 1 ./mprotect; s=$? diff --git a/tools/test/stress2/misc/nullfs22.sh b/tools/test/stress2/misc/nullfs22.sh index f7652d71bf40..12d1c16cd9a3 100755 --- a/tools/test/stress2/misc/nullfs22.sh +++ b/tools/test/stress2/misc/nullfs22.sh @@ -103,7 +103,7 @@ add(int n, int increment) { struct flock fl; off_t pos; - long val, oval; + long val, oval __unused; int r; pos = n * sizeof(val); diff --git a/tools/test/stress2/misc/sendfile.sh b/tools/test/stress2/misc/sendfile.sh index 408564bef0e2..2444721b955f 100755 --- a/tools/test/stress2/misc/sendfile.sh +++ b/tools/test/stress2/misc/sendfile.sh @@ -36,7 +36,7 @@ odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > sendfile.c -mycc -o sendfile -Wall sendfile.c -pthread +mycc -o sendfile -Wall -O0 sendfile.c -pthread rm -f sendfile.c [ -d "$RUNDIR" ] || mkdir -p $RUNDIR cd $RUNDIR @@ -78,7 +78,7 @@ reader(void) { int on; socklen_t len; struct sockaddr_in inetaddr, inetpeer; - int n, t, *buf, fd; + int n, t __unused, *buf, fd; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) diff --git a/tools/test/stress2/misc/sendfile10.sh b/tools/test/stress2/misc/sendfile10.sh index 0bfc4a83da71..df94c0f78ace 100755 --- a/tools/test/stress2/misc/sendfile10.sh +++ b/tools/test/stress2/misc/sendfile10.sh @@ -111,7 +111,7 @@ mess(void) static void reader(void) { - off_t t; + off_t t __unused; int tcpsock, msgsock; int on; socklen_t len; diff --git a/tools/test/stress2/misc/sendfile11.sh b/tools/test/stress2/misc/sendfile11.sh index 439416f063f0..995f9abe358a 100755 --- a/tools/test/stress2/misc/sendfile11.sh +++ b/tools/test/stress2/misc/sendfile11.sh @@ -37,7 +37,7 @@ odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > sendfile11.c -mycc -o sendfile11 -Wall sendfile11.c -pthread || exit 1 +mycc -o sendfile11 -Wall -O0 sendfile11.c -pthread || exit 1 rm -f sendfile11.c set -e @@ -100,7 +100,7 @@ reader(void) { struct sockaddr_in inetaddr, inetpeer; socklen_t len; int tcpsock, msgsock; - int *buf, fd, n, on, t; + int *buf, fd, n, on, t __unused; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) diff --git a/tools/test/stress2/misc/sendfile12.sh b/tools/test/stress2/misc/sendfile12.sh index 05f30c9a292c..bf4ce0018688 100755 --- a/tools/test/stress2/misc/sendfile12.sh +++ b/tools/test/stress2/misc/sendfile12.sh @@ -39,7 +39,7 @@ odir=`pwd` cd /tmp sed '1,/^EOF/d' < $odir/$0 > sendfile12.c -mycc -o sendfile12 -Wall sendfile12.c -pthread || exit 1 +mycc -o sendfile12 -Wall -O0 sendfile12.c -pthread || exit 1 rm -f sendfile12.c set -e @@ -99,7 +99,7 @@ reader(void) { struct sockaddr_in inetaddr, inetpeer; socklen_t len; int tcpsock, msgsock; - int *buf, fd, n, on, t; + int *buf, fd, n, on, t __unused; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) diff --git a/tools/test/stress2/misc/sendfile13.sh b/tools/test/stress2/misc/sendfile13.sh index 9a7b0ad40003..a6ae138a1fd0 100755 --- a/tools/test/stress2/misc/sendfile13.sh +++ b/tools/test/stress2/misc/sendfile13.sh @@ -184,7 +184,7 @@ server(void) struct sockaddr_in inetaddr, inetpeer; socklen_t len; int tcpsock, msgsock; - int *buf, fd, idx, n, on, t; + int *buf, fd, idx, n, on, t __unused; char ofile[128], nfile[128]; sa.sa_handler = SIG_IGN; diff --git a/tools/test/stress2/misc/sendfile14.sh b/tools/test/stress2/misc/sendfile14.sh index 00fc8cd01b99..0c8b64050423 100755 --- a/tools/test/stress2/misc/sendfile14.sh +++ b/tools/test/stress2/misc/sendfile14.sh @@ -176,7 +176,7 @@ server(void) struct sockaddr_in inetaddr, inetpeer; socklen_t len; int tcpsock, msgsock; - int *buf, fd, idx, n, on, t; + int *buf, fd, idx, n, on, t __unused; char ofile[128], nfile[128]; setproctitle("%s", __func__); diff --git a/tools/test/stress2/misc/sendfile2.sh b/tools/test/stress2/misc/sendfile2.sh index 42520c54d708..3df34b80d7d3 100755 --- a/tools/test/stress2/misc/sendfile2.sh +++ b/tools/test/stress2/misc/sendfile2.sh @@ -102,7 +102,7 @@ main () { warn ("fail to connect"); flags = fcntl(s, F_GETFL); flags |= O_NONBLOCK; - fcntl(s, F_SETFL); + fcntl(s, F_SETFL, flags); f = open("large", O_RDONLY); if (f < 0) diff --git a/tools/test/stress2/misc/sendfile21.sh b/tools/test/stress2/misc/sendfile21.sh index 4387d167dfc2..cd36410d9247 100755 --- a/tools/test/stress2/misc/sendfile21.sh +++ b/tools/test/stress2/misc/sendfile21.sh @@ -124,7 +124,7 @@ static void test(void) { struct stat st; - off_t i, j, k, rd, written, pos; + off_t i, j, k __unused, rd, written, pos; pid_t pid; int error, from, n, status, sv[2], to; char buf[4086], *cp; diff --git a/tools/test/stress2/misc/sendfile24.sh b/tools/test/stress2/misc/sendfile24.sh index e61a01a436c5..b9f7d7ac89c2 100755 --- a/tools/test/stress2/misc/sendfile24.sh +++ b/tools/test/stress2/misc/sendfile24.sh @@ -104,7 +104,7 @@ reader(void) { int on; socklen_t len; struct sockaddr_in inetaddr, inetpeer; - int n, t, *buf, fd; + int n, *buf, fd; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) @@ -131,7 +131,6 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); @@ -141,7 +140,6 @@ reader(void) { for (;;) { if ((n = read(msgsock, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; diff --git a/tools/test/stress2/misc/sendfile3.sh b/tools/test/stress2/misc/sendfile3.sh index f46d02d906d8..9d204255f90b 100755 --- a/tools/test/stress2/misc/sendfile3.sh +++ b/tools/test/stress2/misc/sendfile3.sh @@ -88,7 +88,7 @@ reader(void) { int on; socklen_t len; struct sockaddr_in inetaddr, inetpeer; - int n, t, *buf, fd; + int n, *buf, fd; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) @@ -115,7 +115,6 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); @@ -125,7 +124,6 @@ reader(void) { for (;;) { if ((n = read(msgsock, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; if ((write(fd, buf, n)) != n) diff --git a/tools/test/stress2/misc/sendfile8.sh b/tools/test/stress2/misc/sendfile8.sh index ddbcb74ffc02..094ae45ce9ba 100755 --- a/tools/test/stress2/misc/sendfile8.sh +++ b/tools/test/stress2/misc/sendfile8.sh @@ -110,7 +110,7 @@ reader(void) { socklen_t len; int tcpsock, msgsock; int on; - int n, t, *buf, fd; + int n, *buf, fd; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) @@ -137,7 +137,6 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(BUFSIZE)) == NULL) err(1, "malloc(%d), %s:%d", BUFSIZE, __FILE__, __LINE__); @@ -147,7 +146,6 @@ reader(void) { for (;;) { if ((n = read(msgsock, buf, BUFSIZE)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; if ((write(fd, buf, n)) != n) diff --git a/tools/test/stress2/misc/sendfile9.sh b/tools/test/stress2/misc/sendfile9.sh index 989098e09321..b3b301281803 100755 --- a/tools/test/stress2/misc/sendfile9.sh +++ b/tools/test/stress2/misc/sendfile9.sh @@ -109,7 +109,7 @@ reader(void) { socklen_t len; int tcpsock, msgsock; int on; - int n, t, *buf, fd; + int n, *buf, fd; on = 1; if ((tcpsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) @@ -136,7 +136,6 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(BUFSIZE)) == NULL) err(1, "malloc(%d), %s:%d", BUFSIZE, __FILE__, __LINE__); @@ -146,7 +145,6 @@ reader(void) { for (;;) { if ((n = read(msgsock, buf, BUFSIZE)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; if ((write(fd, buf, n)) != n) diff --git a/tools/test/stress2/misc/setsockopt2.sh b/tools/test/stress2/misc/setsockopt2.sh index 89f22602a11e..d032c68f77c4 100755 --- a/tools/test/stress2/misc/setsockopt2.sh +++ b/tools/test/stress2/misc/setsockopt2.sh @@ -204,5 +204,5 @@ main(void) } } - return (0); + return (e); } diff --git a/tools/test/stress2/misc/shm2.sh b/tools/test/stress2/misc/shm2.sh index e1b229030b4a..55d63b19f462 100755 --- a/tools/test/stress2/misc/shm2.sh +++ b/tools/test/stress2/misc/shm2.sh @@ -147,11 +147,10 @@ int main(void) { pid_t pids[INCARNATIONS]; - int i, verbose; + int i; runtime = 120; /* 2 minutes */ utime = 1000; /* 0.001 sec */ - verbose = 0; size = 512 * 1024 * 1024; setup(); diff --git a/tools/test/stress2/misc/tcp3.sh b/tools/test/stress2/misc/tcp3.sh index ca3161c25821..d74eed0835bb 100755 --- a/tools/test/stress2/misc/tcp3.sh +++ b/tools/test/stress2/misc/tcp3.sh @@ -117,7 +117,7 @@ static void reader(void) { struct sockaddr_in inetaddr, inetpeer; socklen_t len; - int n, t, *buf; + int n, *buf; int on; int tcpsock, msgsock; @@ -149,14 +149,12 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); while (done_testing == 0) { if ((n = read(msgsock, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; } close(msgsock); diff --git a/tools/test/stress2/misc/tcp4.sh b/tools/test/stress2/misc/tcp4.sh index 514d73595e54..cc98a4e3d51f 100755 --- a/tools/test/stress2/misc/tcp4.sh +++ b/tools/test/stress2/misc/tcp4.sh @@ -67,7 +67,7 @@ static void reader(void) { socklen_t len; struct sockaddr_in inetaddr, inetpeer; - int tcpsock, msgsock ,on, n, t, *buf; + int tcpsock, msgsock ,on, n, *buf; on = 1; setproctitle("%s", __func__); @@ -99,13 +99,11 @@ reader(void) { (struct sockaddr *)&inetpeer, &len)) < 0) err(1, "accept(), %s:%d", __FILE__, __LINE__); - t = 0; if ((buf = malloc(bufsize)) == NULL) err(1, "malloc(%d), %s:%d", bufsize, __FILE__, __LINE__); for (;;) { if ((n = read(msgsock, buf, bufsize)) < 0) err(1, "read(), %s:%d", __FILE__, __LINE__); - t += n; if (n == 0) break; } close(msgsock); diff --git a/tools/test/stress2/tools/bench.c b/tools/test/stress2/tools/bench.c index e986fb6db791..606c8e6ed726 100644 --- a/tools/test/stress2/tools/bench.c +++ b/tools/test/stress2/tools/bench.c @@ -305,7 +305,7 @@ main(int argc, char *argv[]) pid_t *pids; struct timeval t1, t2, diff; size_t len; - time_t start; + time_t start __unused; int ch, i, status, timing; timing = 0; @@ -334,8 +334,8 @@ main(int argc, char *argv[]) start = time(NULL); spawn(functions[i], i); #if defined(DEBUG) - fprintf(stderr, "%d: %d elapsed\n", i , - time(NULL) - start); + fprintf(stderr, "%d: %ld elapsed\n", i , + (long)(time(NULL) - start)); #endif _exit(0); }