mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-27 00:57:50 +00:00
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
This commit is contained in:
parent
3c217d358e
commit
c50b317dcd
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=24291
@ -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>
|
||||
|
@ -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
|
||||
***************
|
||||
|
73
benchmarks/bonnie/files/patch-ab
Normal file
73
benchmarks/bonnie/files/patch-ab
Normal file
@ -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)
|
8
benchmarks/bonnie/files/patch-ac
Normal file
8
benchmarks/bonnie/files/patch-ac
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user