[zeromq-dev] [Patch] ZeroMQ for OpenBSD

Frank Denis zeromq at pureftpd.org
Tue Oct 28 17:45:25 CET 2008


  Hello,
  
  And congratulations for the 0MQ project.
  
  Here's a trivial diff against the SVN trunk in order to make it
work on OpenBSD.

  The argc sizeof() thing is pretty weird.
  
  Best regards,
  
         -Frank.
-------------- next part --------------
Index: configure.in
===================================================================
--- configure.in	(revision 579)
+++ configure.in	(working copy)
@@ -41,6 +41,11 @@
         CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS"
         LIBS="-pthread"
         ;;
+    *openbsd*)
+        AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS])
+        CPPFLAGS="-pthread $CPPFLAGS"
+        LIBS="-pthread"
+        ;;
     *darwin*)
         AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS])
         LIBS="-pthread"
@@ -217,6 +222,9 @@
         *solaris*)
             JAVA_INCLUDE="-I.. -I${JAVA_HOME}/include -I ${JAVA_HOME}/include/solaris"
         ;;
+        *openbsd*)
+            JAVA_INCLUDE="-I.. -I${JAVA_HOME}/include -I ${JAVA_HOME}/include/openbsd"
+        ;;
         *)
             JAVA_INCLUDE="-I.. -I${JAVA_HOME}/include -I ${JAVA_HOME}/include/linux"
         ;;
Index: zmq/poll_thread.hpp
===================================================================
--- zmq/poll_thread.hpp	(revision 579)
+++ zmq/poll_thread.hpp	(working copy)
@@ -24,7 +24,8 @@
 #include "platform.hpp"
 
 #if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
-    defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_SOLARIS
+    defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_SOLARIS ||\
+    defined ZMQ_HAVE_OPENBSD
 
 #include <stddef.h>
 #include <assert.h>
Index: zmq/poll_thread.cpp
===================================================================
--- zmq/poll_thread.cpp	(revision 579)
+++ zmq/poll_thread.cpp	(working copy)
@@ -24,7 +24,8 @@
 #include "err.hpp"
 
 #if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
-    defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_SOLARIS
+    defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_SOLARIS ||\
+    defined ZMQ_HAVE_OPENBSD
 
 zmq::i_thread *zmq::poll_thread_t::create (dispatcher_t *dispatcher_)
 {
Index: zmq/platform.hpp.in
===================================================================
--- zmq/platform.hpp.in	(revision 579)
+++ zmq/platform.hpp.in	(working copy)
@@ -10,3 +10,6 @@
 /* Have FreeBSD OS */
 #undef ZMQ_HAVE_FREEBSD
 
+/* Have OpenBSD OS */
+#undef ZMQ_HAVE_OPENBSD
+
Index: zmq/ysemaphore.hpp
===================================================================
--- zmq/ysemaphore.hpp	(revision 579)
+++ zmq/ysemaphore.hpp	(working copy)
@@ -29,7 +29,8 @@
 
 #ifdef ZMQ_HAVE_WINDOWS
 #include <windows.h>
-#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_SOLARIS)
+#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_SOLARIS ||\
+       defined ZMQ_HAVE_OPENBSD)
 #include <semaphore.h>
 #else
 #include <pthread.h>
@@ -98,7 +99,8 @@
         void operator = (const ysemaphore_t&);
     };
 
-#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_SOLARIS)
+#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_SOLARIS ||\
+       defined ZMQ_HAVE_OPENBSD)
 
     class ysemaphore_t : public i_signaler
     { 
Index: zmq/zmq_server.cpp
===================================================================
--- zmq/zmq_server.cpp	(revision 579)
+++ zmq/zmq_server.cpp	(working copy)
@@ -98,10 +98,9 @@
     //  Create a tcp_listener.
     char iface [256] = "0.0.0.0:";
     char tmp [10];
-    if (argc == 2 && (sizeof (argc)== 4 * sizeof (char) ||
-        sizeof (argc)== 5 * sizeof (char) )) { 
+    if (argc == 2) {
 	   //  The argument is port.
-	   zmq_snprintf (tmp, sizeof(argv[1]), "%s", argv[1]);
+	   zmq_snprintf (tmp, sizeof(tmp), "%s", argv[1]);
     }	
     else {
         zmq_sprintf (tmp, "%d", default_locator_port);   
Index: zmq/ip.cpp
===================================================================
--- zmq/ip.cpp	(revision 579)
+++ zmq/ip.cpp	(working copy)
@@ -110,7 +110,7 @@
 }
 
 #elif (defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\
-    defined ZMQ_HAVE_OSX)
+    defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD)
 
 #include <ifaddrs.h>
 


More information about the zeromq-dev mailing list