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 ) 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 ; 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 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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 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 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 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