summary refs log tree commit diff
path: root/pkgs/tools/filesystems/bonnie/bonnie-homebrew.patch
blob: e4903143f11c340f6a9f6f0e565217931998bd63 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Copyright 2009-2016 Homebrew contributors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

 1. Redistributions of source code must retain the above copyright
    notice, this list of conditions and the following disclaimer.
 2. Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


# Changes included in this patchset:
# 1) Explicitly use clang/clang++ in Makefile
# 2) __min() and __max() macros break bon_csv2html.cpp: "redefinition of 'min' as different kind of symbol"
#    Remove the construct in favor of macro targets min()/max() provided by the library
#    Files affected: port.h.in port.h duration.cpp bonnie++.cpp
# 3) Remove the #ifdef _LARGEFILE64_SOURCE macros which not only prohibits the intended functionality of
#    splitting into 2 GB files for such filesystems but also incorrectly tests for it in the first place.
#    The ideal fix would be to replace the AC_TRY_RUN() in configure.in if the fail code actually worked.
#    Files affected: bonnie++.cp

diff --git i/Makefile w/Makefile
index 4bb5103..8f7ed41 100644
--- i/Makefile
+++ w/Makefile
@@ -10,8 +10,8 @@ eprefix=${prefix}
 #MORE_WARNINGS=-Weffc++
 WFLAGS=-Wall -W -Wshadow -Wpointer-arith -Wwrite-strings -pedantic -ffor-scope -Wcast-align -Wsign-compare -Wpointer-arith -Wwrite-strings -Wformat-security -Wswitch-enum -Winit-self $(MORE_WARNINGS)
 CFLAGS=-O2  -DNDEBUG $(WFLAGS) $(MORECFLAGS)
-CXX=g++ $(CFLAGS)
-LINK=g++
+CXX=clang++ $(CFLAGS)
+LINK=clang++
 THREAD_LFLAGS=-lpthread

 INSTALL=/usr/bin/install -c
diff --git i/bonnie++.cpp w/bonnie++.cpp
index 8c5a43a..8a4b3dc 100644
--- i/bonnie++.cpp
+++ w/bonnie++.cpp
@@ -73,7 +73,7 @@ public:
   void set_io_chunk_size(int size)
     { delete m_buf; pa_new(size, m_buf, m_buf_pa); m_io_chunk_size = size; }
   void set_file_chunk_size(int size)
-    { delete m_buf; m_buf = new char[__max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
+    { delete m_buf; m_buf = new char[max(size, m_io_chunk_size)]; m_file_chunk_size = size; }
 
   // Return the page-aligned version of the local buffer
   char *buf() { return m_buf_pa; }
@@ -138,7 +138,7 @@ CGlobalItems::CGlobalItems(bool *exitFlag)
  , m_buf(NULL)
  , m_buf_pa(NULL)
 {
-  pa_new(__max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
+  pa_new(max(m_io_chunk_size, m_file_chunk_size), m_buf, m_buf_pa);
   SetName(".");
 }
 
@@ -294,11 +294,7 @@ int main(int argc, char *argv[])
       {
         char *sbuf = _strdup(optarg);
         char *size = strtok(sbuf, ":");
-#ifdef _LARGEFILE64_SOURCE
         file_size = size_from_str(size, "gt");
-#else
-        file_size = size_from_str(size, "g");
-#endif
         size = strtok(NULL, "");
         if(size)
         {
@@ -384,17 +380,8 @@ int main(int argc, char *argv[])
     if(file_size % 1024 > 512)
       file_size = file_size + 1024 - (file_size % 1024);
   }
-#ifndef _LARGEFILE64_SOURCE
-  if(file_size == 2048)
-    file_size = 2047;
-  if(file_size > 2048)
-  {
-    fprintf(stderr, "Large File Support not present, can't do %dM.\n", file_size);
-    usage();
-  }
-#endif
-  globals.byte_io_size = __min(file_size, globals.byte_io_size);
-  globals.byte_io_size = __max(0, globals.byte_io_size);
+  globals.byte_io_size = min(file_size, globals.byte_io_size);
+  globals.byte_io_size = max(0, globals.byte_io_size);
 
   if(machine == NULL)
   {
@@ -465,14 +452,6 @@ int main(int argc, char *argv[])
      && (directory_max_size < directory_min_size || directory_max_size < 0
      || directory_min_size < 0) )
     usage();
-#ifndef _LARGEFILE64_SOURCE
-  if(file_size > (1 << (31 - 20 + globals.io_chunk_bits)) )
-  {
-    fprintf(stderr
-   , "The small chunk size and large IO size make this test impossible in 32bit.\n");
-    usage();
-  }
-#endif
   if(file_size && globals.ram && (file_size * concurrency) < (globals.ram * 2) )
   {
     fprintf(stderr
diff --git i/duration.cpp w/duration.cpp
index efa3fd3..f943155 100644
--- i/duration.cpp
+++ w/duration.cpp
@@ -38,7 +38,7 @@ double Duration_Base::stop()
   getTime(&tv);
   double ret;
   ret = tv - m_start;
-  m_max = __max(m_max, ret);
+  m_max = max(m_max, ret);
   return ret;
 }
 
diff --git i/port.h w/port.h
index 8d53622..2e1f112 100644
--- i/port.h
+++ w/port.h
@@ -49,8 +49,6 @@ typedef struct timeval TIMEVAL_TYPE;
 #endif
 
 typedef int FILE_TYPE;
-#define __min min
-#define __max max
 typedef unsigned int UINT;
 typedef unsigned long ULONG;
 typedef const char * PCCHAR;
diff --git i/port.h.in w/port.h.in
index 69c8f24..8359d72 100644
--- i/port.h.in
+++ w/port.h.in
@@ -49,8 +49,6 @@ typedef struct timeval TIMEVAL_TYPE;
 #endif
 
 typedef int FILE_TYPE;
-#define __min min
-#define __max max
 typedef unsigned int UINT;
 typedef unsigned long ULONG;
 typedef const char * PCCHAR;