summaryrefslogtreecommitdiff
path: root/7e/de89b32aafb43301cf63536abadd3f2505b230
blob: fda9922c967c8214508d1ce80ec9722efba9b724 (plain)
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194]
	helo=mx.sourceforge.net)
	by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <extrudedaluminiu@gmail.com>) id 1QqGCE-0001YV-FM
	for bitcoin-development@lists.sourceforge.net;
	Mon, 08 Aug 2011 03:08:06 +0000
Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of gmail.com
	designates 209.85.212.47 as permitted sender)
	client-ip=209.85.212.47;
	envelope-from=extrudedaluminiu@gmail.com;
	helo=mail-vw0-f47.google.com; 
Received: from mail-vw0-f47.google.com ([209.85.212.47])
	by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:RC4-SHA:128)
	(Exim 4.76) id 1QqGCB-0005hK-Vt
	for bitcoin-development@lists.sourceforge.net;
	Mon, 08 Aug 2011 03:08:06 +0000
Received: by vws2 with SMTP id 2so2235897vws.34
	for <bitcoin-development@lists.sourceforge.net>;
	Sun, 07 Aug 2011 20:07:58 -0700 (PDT)
Received: by 10.52.188.2 with SMTP id fw2mr5322192vdc.17.1312772877812;
	Sun, 07 Aug 2011 20:07:57 -0700 (PDT)
Received: from challenger. (c-68-48-11-23.hsd1.md.comcast.net [68.48.11.23])
	by mx.google.com with ESMTPS id jv3sm2718110vdb.23.2011.08.07.20.07.54
	(version=TLSv1/SSLv3 cipher=OTHER);
	Sun, 07 Aug 2011 20:07:56 -0700 (PDT)
Sender: Venkatesh Srinivas <extrudedaluminiu@gmail.com>
Received: from me (uid 1001) (envelope-from me@challenger.) id 34472638f
	by challenger. (DragonFly Mail Agent) Sun, 07 Aug 2011 23:07:53 -0400
Date: Sun, 7 Aug 2011 23:07:52 -0400
From: Venkatesh Srinivas <me@endeavour.zapto.org>
To: bitcoin-development@lists.sourceforge.net
Message-ID: <4e3f530c.6374340a.2490.7a81@mx.google.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="gatW/ieO32f1wygP"
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spam-Score: -1.5 (-)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider
	(extrudedaluminiu[at]gmail.com)
	-0.0 SPF_PASS               SPF: sender matches SPF record
	0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay
	lines 0.0 T_FRT_STOCK2           BODY: ReplaceTags: Stock (2)
	0.1 DKIM_SIGNED            Message has a DKIM or DK signature,
	not necessarily valid
	-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature
	0.0 T_TO_NO_BRKTS_FREEMAIL To: misformatted and free email service
X-Headers-End: 1QqGCB-0005hK-Vt
Subject: [Bitcoin-development] DragonFly BSD bitcoind patches
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Mon, 08 Aug 2011 03:08:06 -0000


--gatW/ieO32f1wygP
Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X"
Content-Disposition: inline


--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Disposition: inline

Hi,

Related to https://bitcointalk.org/index.php?topic=28022.0 ;

Here are three patches that allow bitcoind to build and run on DragonFly BSD.

0001) bitcoind assumes a definition of BSD implies SO_NOSIGPIPE is available.
This is not true on NetBSD, OpenBSD, and DragonFly.

0002) main.cpp has: "char pchMessageStart[4] = { 0xf9, 0xbe, 0xb4, 0xd9 };"
Per discussion on the thread linked, leaving the signedness of pchMessageStart
is unsafe for values > 0x80. This patch specifies 'unsigned char' in main.cpp
and net.h.

0003) db.cpp has a number of uses of make_tuple and has 'using namespace std'
and 'using namespace boost'. Without qualifying make_tuple, std::make_tuple is
preferred, which is incorrect. This patch qualifies make_tuple.

Patches are from git format-patch and can be applied with git-am.

Thanks,
-- vs

--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="0001-Test-for-SO_NOSIGPIPE-rather-than-assuming-all-BSDs-.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 310cd8d1bdd130d04c98e5e724b2af904fe94e2e Mon Sep 17 00:00:00 2001
=46rom: Venkatesh Srinivas <me@endeavour.zapto.org>
Date: Sun, 7 Aug 2011 12:18:05 -0400
Subject: [PATCH 1/3] Test for SO_NOSIGPIPE rather than assuming all BSDs
 support it.

---
 src/net.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/net.cpp b/src/net.cpp
index d697788..9feeb43 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -98,7 +98,7 @@ bool ConnectSocket(const CAddress& addrConnect, SOCKET& h=
SocketRet, int nTimeout
     SOCKET hSocket =3D socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
     if (hSocket =3D=3D INVALID_SOCKET)
         return false;
-#ifdef BSD
+#ifdef SO_NOSIGPIPE
     int set =3D 1;
     setsockopt(hSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&set, sizeof(int)=
);
 #endif
@@ -1579,7 +1579,7 @@ bool BindListenPort(string& strError)
         return false;
     }
=20
-#ifdef BSD
+#ifdef SO_NOSIGPIPE
     // Different way of disabling SIGPIPE on BSD
     setsockopt(hListenSocket, SOL_SOCKET, SO_NOSIGPIPE, (void*)&nOne, size=
of(int));
 #endif
--=20
1.7.5.4


--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="0002-Use-unsigned-char-rather-than-char-for-pchMessageSta.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 7ed0ddde65b3f5c467e471fc6f9fff648b976e56 Mon Sep 17 00:00:00 2001
=46rom: Venkatesh Srinivas <me@endeavour.zapto.org>
Date: Sun, 7 Aug 2011 12:19:14 -0400
Subject: [PATCH 2/3] Use 'unsigned char' rather than 'char' for
 pchMessageStart.

---
 src/main.cpp |    2 +-
 src/net.h    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.cpp b/src/main.cpp
index b57974f..4bcb87f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1766,7 +1766,7 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv)
 // The message start string is designed to be unlikely to occur in normal =
data.
 // The characters are rarely used upper ascii, not valid as UTF-8, and pro=
duce
 // a large 4-byte int at any alignment.
-char pchMessageStart[4] =3D { 0xf9, 0xbe, 0xb4, 0xd9 };
+unsigned char pchMessageStart[4] =3D { 0xf9, 0xbe, 0xb4, 0xd9 };
=20
=20
 bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& v=
Recv)
diff --git a/src/net.h b/src/net.h
index 78055bf..6678e56 100644
--- a/src/net.h
+++ b/src/net.h
@@ -66,7 +66,7 @@ bool StopNode();
 //  (4) size
 //  (4) checksum
=20
-extern char pchMessageStart[4];
+extern unsigned char pchMessageStart[4];
=20
 class CMessageHeader
 {
--=20
1.7.5.4


--LZvS9be/3tNcYl/X
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename="0003-Qualify-make_tuple-with-boost-namespace.patch"
Content-Transfer-Encoding: quoted-printable

=46rom 74647b73e06ae5b4ec995873a8ef56977f3b7e93 Mon Sep 17 00:00:00 2001
=46rom: Venkatesh Srinivas <me@endeavour.zapto.org>
Date: Sun, 7 Aug 2011 12:20:00 -0400
Subject: [PATCH 3/3] Qualify make_tuple with boost:: namespace.

---
 src/db.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/db.cpp b/src/db.cpp
index 9c8c9c4..b3fa3e1 100644
--- a/src/db.cpp
+++ b/src/db.cpp
@@ -610,7 +610,7 @@ bool CWalletDB::WriteAccount(const string& strAccount, =
const CAccount& account)
=20
 bool CWalletDB::WriteAccountingEntry(const CAccountingEntry& acentry)
 {
-    return Write(make_tuple(string("acentry"), acentry.strAccount, ++nAcco=
untingEntryNumber), acentry);
+    return Write(boost::make_tuple(string("acentry"), acentry.strAccount, =
++nAccountingEntryNumber), acentry);
 }
=20
 int64 CWalletDB::GetAccountCreditDebit(const string& strAccount)
@@ -638,7 +638,7 @@ void CWalletDB::ListAccountCreditDebit(const string& st=
rAccount, list<CAccountin
         // Read next record
         CDataStream ssKey;
         if (fFlags =3D=3D DB_SET_RANGE)
-            ssKey << make_tuple(string("acentry"), (fAllAccounts? string("=
") : strAccount), uint64(0));
+            ssKey << boost::make_tuple(string("acentry"), (fAllAccounts? s=
tring("") : strAccount), uint64(0));
         CDataStream ssValue;
         int ret =3D ReadAtCursor(pcursor, ssKey, ssValue, fFlags);
         fFlags =3D DB_NEXT;
--=20
1.7.5.4


--LZvS9be/3tNcYl/X--

--gatW/ieO32f1wygP
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (DragonFly)

iEYEARECAAYFAk4/UwcACgkQ+zApffxCWtA8/wCfbxZv2Vnwt/orRS26C7zkCCNg
z40An3E3Fd1tluW8MT5ymyZLU63v2NbN
=Xb46
-----END PGP SIGNATURE-----

--gatW/ieO32f1wygP--