stress2: Fix "set but not used [-Wunused-but-set-variable]" warnings
This commit is contained in:
parent
656194f140
commit
8d72c409cd
@ -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) {
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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]);
|
||||
|
@ -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);
|
||||
|
@ -101,9 +101,7 @@ test(void) {
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
signal(SIGALRM, handler);
|
||||
alarm(60);
|
||||
|
||||
|
@ -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];
|
||||
|
@ -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];
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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()");
|
||||
|
@ -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)");
|
||||
|
@ -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;
|
||||
|
@ -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=$?
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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__);
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -204,5 +204,5 @@ main(void)
|
||||
}
|
||||
}
|
||||
|
||||
return (0);
|
||||
return (e);
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user