[Pdns-dev] PowerDNS on a Raspberry Pi running NetBSD

Christof Meerwald cmeerw at cmeerw.org
Sat Jun 15 16:47:57 CEST 2013


Hi,

just tried running PowerDNS (Recursor 3.5.2 and auth 3.3-pc1) on my
Raspberry Pi (with NetBSD 6.1) - and it worked with some small code
changes:

diff -ur pdns-recursor-3.5.2.orig/logger.cc pdns-recursor-3.5.2/logger.cc
--- pdns-recursor-3.5.2.orig/logger.cc	2013-06-07 07:05:34.000000000 +0000
+++ pdns-recursor-3.5.2/logger.cc	2013-01-20 00:03:52.000000000 +0000
@@ -163,6 +163,15 @@
   return *this;
 }
 
+Logger& Logger::operator<<(long long i)
+{
+  ostringstream tmp;
+  tmp<<i;
+
+  *this<<tmp.str();
+
+  return *this;
+}
 
 Logger& Logger::operator<<(long i)
 {
diff -ur pdns-recursor-3.5.2.orig/logger.hh pdns-recursor-3.5.2/logger.hh
--- pdns-recursor-3.5.2.orig/logger.hh	2013-06-07 07:05:34.000000000 +0000
+++ pdns-recursor-3.5.2/logger.hh	2013-01-20 00:03:25.000000000 +0000
@@ -115,6 +115,7 @@
   Logger& operator<<(long);   //!< log an unsigned int
   Logger& operator<<(unsigned long);   //!< log an unsigned int
   Logger& operator<<(unsigned long long);   //!< log an unsigned 64 bit int
+  Logger& operator<<(long long);   //!< log a signed 64 bit int
   Logger& operator<<(Urgency);    //!< set the urgency, << style
 
 #ifndef WIN32
diff -ur pdns-recursor-3.5.2.orig/misc.hh pdns-recursor-3.5.2/misc.hh
--- pdns-recursor-3.5.2.orig/misc.hh	2013-06-07 07:05:34.000000000 +0000
+++ pdns-recursor-3.5.2/misc.hh	2013-06-15 14:03:10.000000000 +0000
@@ -68,6 +68,10 @@
 #include <ctype.h>
 #include <vector>
 
+#if defined( __NetBSD__ ) && defined( __arm__ )
+#include <sys/atomic.h>
+#endif
+
 #include "namespaces.hh"
 bool chopOff(string &domain);
 bool chopOffDotted(string &domain);
@@ -386,6 +390,12 @@
 
         return r;
     }
+    #elif defined( __NetBSD__ ) && defined( __arm__ )
+    static int atomic_exchange_and_add( unsigned int * pw, int dv )
+    {
+      membar_sync();
+      return atomic_add_int_nv(pw, dv) - dv;
+    }
     #else 
     static int atomic_exchange_and_add( unsigned int * pw, int dv )
     {


So, time_t is defined as int64_t (i.e. long long), therefore I needed
to add another overload to Logger to avoid overload resolution
disambiguities.

__sync_fetch_and_add doesn't seem to be supported on that particular
platform, but there is a sys/atomic.h header providing similar
functions.


Christof

-- 

http://cmeerw.org                              sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org                   xmpp:cmeerw at cmeerw.org



More information about the Pdns-dev mailing list