diff options
author | Stefan Eßer <se@FreeBSD.org> | 1999-12-30 17:18:22 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 1999-12-30 17:18:22 +0000 |
commit | c50b317dcd4ac735221282ce3884b194f42cc767 (patch) | |
tree | b1962977b3674fa46e7de3bd0ce9802f081aa7a5 /benchmarks/bonnie | |
parent | 3c217d358e6e018ca00b6c874b588ec1c65175aa (diff) | |
download | ports-c50b317dcd4ac735221282ce3884b194f42cc767.tar.gz ports-c50b317dcd4ac735221282ce3884b194f42cc767.zip |
Prevent overflow of "size" for file sizes of 2048MB and more (PR 11430).
While I'm here:
- Make a error message start on a new line.
- Move installation into port Makefile.
- Split patch-aa in two (add -ac), it modified two files.
- Close file descriptor 0 in seeker processes.
PR: 11430
Notes
Notes:
svn path=/head/; revision=24291
Diffstat (limited to 'benchmarks/bonnie')
-rw-r--r-- | benchmarks/bonnie/Makefile | 5 | ||||
-rw-r--r-- | benchmarks/bonnie/files/patch-aa | 24 | ||||
-rw-r--r-- | benchmarks/bonnie/files/patch-ab | 73 | ||||
-rw-r--r-- | benchmarks/bonnie/files/patch-ac | 8 |
4 files changed, 86 insertions, 24 deletions
diff --git a/benchmarks/bonnie/Makefile b/benchmarks/bonnie/Makefile index a22c567aa24f..1b8bf277229e 100644 --- a/benchmarks/bonnie/Makefile +++ b/benchmarks/bonnie/Makefile @@ -17,5 +17,10 @@ MAINTAINER= se@FreeBSD.org MAN1= bonnie.1 CFLAGS+= -static +MAKE_ARGS+= CFLAGS="${CFLAGS}" + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/Bonnie ${PREFIX}/bin/bonnie + ${INSTALL_DATA} ${WRKSRC}/bonnie.1 ${PREFIX}/man/man1 .include <bsd.port.mk> diff --git a/benchmarks/bonnie/files/patch-aa b/benchmarks/bonnie/files/patch-aa index 7d4e7e90089e..bf6c442a985a 100644 --- a/benchmarks/bonnie/files/patch-aa +++ b/benchmarks/bonnie/files/patch-aa @@ -1,27 +1,3 @@ -diff -C2 Makefile~ Makefile -*** Makefile~ Wed Aug 21 17:19:11 1991 ---- Makefile Thu May 18 20:27:19 1995 -*************** -*** 1,7 **** - -! CC = cc -! CFLAGS = -O2 - -! all: Bonnie -! -! Bonnie: ---- 1,10 ---- -+ all: bonnie - -! bonnie: -! $(CC) $(CFLAGS) -static -o bonnie Bonnie.c - -! install: -! -@mkdir -p ${PREFIX}/bin -! -@mkdir -p ${PREFIX}/man/man1 -! ${INSTALL} ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} bonnie ${PREFIX}/bin -! ${INSTALL} ${COPY} -o ${BINOWN} -g ${BINGRP} -m 644 bonnie.1 ${PREFIX}/man/man1 -diff -C2 /dev/null bonnie.1 *** /dev/null Thu May 18 20:25:21 1995 --- bonnie.1 Thu May 18 20:26:47 1995 *************** diff --git a/benchmarks/bonnie/files/patch-ab b/benchmarks/bonnie/files/patch-ab new file mode 100644 index 000000000000..e598f7be6c39 --- /dev/null +++ b/benchmarks/bonnie/files/patch-ab @@ -0,0 +1,73 @@ +--- Bonnie.c~ Wed Aug 21 17:18:50 1991 ++++ Bonnie.c Thu Dec 30 17:49:15 1999 +@@ -162,7 +162,7 @@ + char seek_tickets[Seeks + SeekProcCount]; + double seeker_report[3]; +- int size; ++ quad_t size; + FILE * stream; +- int words; ++ off_t words; + + fd = -1; +@@ -195,5 +195,5 @@ + size *= (1024 * 1024); + sprintf(name, "%s/Bonnie.%d", dir, getpid()); +- fprintf(stderr, "File '%s', size: %d\n", name, size); ++ fprintf(stderr, "File '%s', size: %qd\n", name, size); + + /* Fill up a file, writing it a char at a time with the stdio putc() call */ +@@ -228,5 +228,5 @@ + bufindex = 0; + buf[bufindex++]++; +- if (lseek(fd, (off_t) -words, 1) == -1) ++ if (lseek(fd, -words, 1) == -1) + io_error("relative lseek(2)"); + if (write(fd, (char *) buf, words) == -1) +@@ -337,4 +337,5 @@ + + /* set up and wait for the go-ahead */ ++ close(0); + close(seek_feedback[0]); + close(seek_control[1]); +@@ -352,5 +353,11 @@ + while(seek_tickets[0]) + { /* until Mom says stop */ +- doseek((long) (random() % size), fd, ++ off_t seekto; ++ if (size < ((off_t)1 << 32)) ++ seekto = random() % size; ++ else ++ seekto = ((off_t)random() << 32 + random()) % size; ++ ++ doseek(seekto, fd, + ((lseek_count++ % UpdateSeek) == 0)); + if (read(seek_control[0], seek_tickets, 1) != 1) +@@ -422,5 +429,5 @@ + static void + report(size) +- int size; ++ quad_t size; + { + printf(" "); +@@ -434,5 +441,5 @@ + printf("%%CPU /sec %%CPU\n"); + +- printf("%-8.8s %4d ", machine, size / (1024 * 1024)); ++ printf("%-8.8s %4qd ", machine, size / (1024 * 1024)); + printf("%5d %4.1f %5d %4.1f %5d %4.1f ", + (int) (((double) size) / (delta[(int) Putc][Elapsed] * 1024.0)), +@@ -551,5 +558,5 @@ + char buf[Chunk]; + +- sprintf(buf, "Bonnie: drastic I/O error (%s)", message); ++ sprintf(buf, "\nBonnie: drastic I/O error (%s)", message); + perror(buf); + exit(1); +@@ -593,5 +600,5 @@ + /* touch a word */ + buf[((int) random() % (size/IntSize - 2)) + 1]--; +- if (lseek(fd, (long) probe, 0) != probe) ++ if (lseek(fd, probe, 0) != probe) + io_error("lseek in doseek update"); + if (write(fd, (char *) buf, size) == -1) diff --git a/benchmarks/bonnie/files/patch-ac b/benchmarks/bonnie/files/patch-ac new file mode 100644 index 000000000000..f2822459473a --- /dev/null +++ b/benchmarks/bonnie/files/patch-ac @@ -0,0 +1,8 @@ +--- Makefile~ Wed Aug 21 17:19:11 1991 ++++ Makefile Thu Dec 30 17:22:01 1999 +@@ -1,5 +1,4 @@ + + CC = cc +-CFLAGS = -O2 + + all: Bonnie |