From 60ce5cc82a48d5881cb493a5b6b3afba19bd0863 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Tue, 16 Feb 2010 19:58:55 +0100 Subject: PGM tarball should be removed on 'distclean', not 'clean' --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 51f6128..b4145c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -14,6 +14,6 @@ $(top_srcdir)/foreign/xmlParser/xmlParser.hpp dist-hook: -rm -rf $(distdir)/foreign/openpgm/@pgm_basename@ -clean-local: +distclean-local: -rm -rf $(top_srcdir)/foreign/openpgm/@pgm_basename@ -- cgit v1.2.3 From 4190f64d8cfc3950bc456ea7793db72130d05feb Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 16 Feb 2010 22:19:33 +0100 Subject: Special exception clause added to LGPL license --- COPYING.LESSER | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/COPYING.LESSER b/COPYING.LESSER index 3f7b8b1..53a8195 100644 --- a/COPYING.LESSER +++ b/COPYING.LESSER @@ -1,4 +1,4 @@ - GNU LESSER GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. @@ -164,3 +164,18 @@ apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. + + + + + SPECIAL EXCEPTION GRANTED BY IMATIX + +As a special exception, iMatix gives you permission to link this library with +independent modules to produce an executable, regardless of the license terms +of these independent modules, and to copy and distribute the resulting +executable under terms of your choice, provided that you also meet, for each +linked independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from or based on +this library. If you modify this library, you must extend this exception to your +version of the library. + -- cgit v1.2.3 From 1e7878489dc5d3013b5e5858fe404ab6b4a6947a Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 16 Feb 2010 23:02:59 +0100 Subject: exconf.rb checks for libzmq.so installation --- AUTHORS | 1 + bindings/ruby/extconf.rb | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 24e980b..b4447e0 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,6 +18,7 @@ Martin Hurton Martin Lucina Martin Sustrik Matus Hamorsky +McClain Looney Pavel Gushcha Pavol Malosek Steven McCoy diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb index d5778d0..30c70fb 100644 --- a/bindings/ruby/extconf.rb +++ b/bindings/ruby/extconf.rb @@ -18,7 +18,11 @@ require 'mkmf' dir_config('libzmq') -have_library('libzmq') -create_makefile("ruby") +if have_library('libzmq', 'zmq_init') + puts "Cool, I found your zmq install..." + create_makefile("zmq") +else + raise "Couldn't find zmq library. try setting --with-zmq-dir= to tell me where it is." +end -- cgit v1.2.3 From 33cb20a747a2ca2c7b0487b023cfd6548ffe11e8 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 16 Feb 2010 23:31:17 +0100 Subject: ZMQII-77: Put librbzmq symbols into ZMQ module --- AUTHORS | 1 + bindings/ruby/rbzmq.cpp | 75 +++++++++++++++++++++++++------------------------ perf/ruby/local_lat.rb | 4 +-- perf/ruby/local_thr.rb | 6 ++-- perf/ruby/remote_lat.rb | 4 +-- perf/ruby/remote_thr.rb | 4 +-- 6 files changed, 49 insertions(+), 45 deletions(-) diff --git a/AUTHORS b/AUTHORS index b4447e0..8e2bd72 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ Contributors Alexej Lotz Asko Kauppi Barak Amar +Chris Wong Conrad D. Steenberg Dhruva Krishnamurthy Dirk O. Kaar diff --git a/bindings/ruby/rbzmq.cpp b/bindings/ruby/rbzmq.cpp index fce749c..9683de4 100644 --- a/bindings/ruby/rbzmq.cpp +++ b/bindings/ruby/rbzmq.cpp @@ -69,8 +69,8 @@ static VALUE socket_initialize (VALUE self_, VALUE context_, VALUE type_) { assert (!DATA_PTR (self_)); - if (strcmp (rb_obj_classname (context_), "Context") != 0) { - rb_raise (rb_eArgError, "expected Context object"); + if (strcmp (rb_obj_classname (context_), "ZMQ::Context") != 0) { + rb_raise (rb_eArgError, "expected ZMQ::Context object"); return Qnil; } @@ -103,7 +103,7 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_, long optval = FIX2LONG (optval_); // Forward the code to native 0MQ library. - rc = zmq_setsockopt (DATA_PTR (self_), NUM2INT (option_), + rc = zmq_setsockopt (DATA_PTR (self_), NUM2INT (option_), (void *) &optval, 4); } break; @@ -113,8 +113,8 @@ static VALUE socket_setsockopt (VALUE self_, VALUE option_, case ZMQ_UNSUBSCRIBE: // Forward the code to native 0MQ library. - rc = zmq_setsockopt (DATA_PTR (self_), NUM2INT (option_), - (void *) StringValueCStr (optval_), RSTRING_LEN (optval_)); + rc = zmq_setsockopt (DATA_PTR (self_), NUM2INT (option_), + (void *) StringValueCStr (optval_), RSTRING_LEN (optval_)); break; default: @@ -170,7 +170,7 @@ static VALUE socket_send (VALUE self_, VALUE msg_, VALUE flags_) return Qnil; } memcpy (zmq_msg_data (&msg), RSTRING_PTR (msg_), RSTRING_LEN (msg_)); - + rc = zmq_send (DATA_PTR (self_), &msg, NUM2INT (flags_)); if (rc != 0 && errno == EAGAIN) { rc = zmq_msg_close (&msg); @@ -233,13 +233,16 @@ static VALUE socket_recv (VALUE self_, VALUE flags_) } extern "C" void Init_librbzmq () -{ - VALUE context_type = rb_define_class ("Context", rb_cObject); +{ + VALUE zmq_module = rb_define_module ("ZMQ"); + VALUE context_type = rb_define_class_under (zmq_module, "Context", + rb_cObject); rb_define_alloc_func (context_type, context_alloc); rb_define_method (context_type, "initialize", (VALUE(*)(...)) context_initialize, 3); - VALUE socket_type = rb_define_class ("Socket", rb_cObject); + VALUE socket_type = rb_define_class_under (zmq_module, "Socket", + rb_cObject); rb_define_alloc_func (socket_type, socket_alloc); rb_define_method (socket_type, "initialize", (VALUE(*)(...)) socket_initialize, 2); @@ -256,31 +259,31 @@ extern "C" void Init_librbzmq () rb_define_method (socket_type, "recv", (VALUE(*)(...)) socket_recv, 1); - rb_define_global_const ("HWM", INT2NUM (ZMQ_HWM)); - rb_define_global_const ("LWM", INT2NUM (ZMQ_LWM)); - rb_define_global_const ("SWAP", INT2NUM (ZMQ_SWAP)); - rb_define_global_const ("AFFINITY", INT2NUM (ZMQ_AFFINITY)); - rb_define_global_const ("IDENTITY", INT2NUM (ZMQ_IDENTITY)); - rb_define_global_const ("SUBSCRIBE", INT2NUM (ZMQ_SUBSCRIBE)); - rb_define_global_const ("UNSUBSCRIBE", INT2NUM (ZMQ_UNSUBSCRIBE)); - rb_define_global_const ("RATE", INT2NUM (ZMQ_RATE)); - rb_define_global_const ("RECOVERY_IVL", INT2NUM (ZMQ_RECOVERY_IVL)); - rb_define_global_const ("MCAST_LOOP", INT2NUM (ZMQ_MCAST_LOOP)); - rb_define_global_const ("SNDBUF", INT2NUM (ZMQ_SNDBUF)); - rb_define_global_const ("RCVBUF", INT2NUM (ZMQ_RCVBUF)); - - rb_define_global_const ("NOBLOCK", INT2NUM (ZMQ_NOBLOCK)); - rb_define_global_const ("NOFLUSH", INT2NUM (ZMQ_NOFLUSH)); - - rb_define_global_const ("P2P", INT2NUM (ZMQ_P2P)); - rb_define_global_const ("SUB", INT2NUM (ZMQ_SUB)); - rb_define_global_const ("PUB", INT2NUM (ZMQ_PUB)); - rb_define_global_const ("REQ", INT2NUM (ZMQ_REQ)); - rb_define_global_const ("REP", INT2NUM (ZMQ_REP)); - rb_define_global_const ("XREQ", INT2NUM (ZMQ_XREQ)); - rb_define_global_const ("XREP", INT2NUM (ZMQ_XREP)); - rb_define_global_const ("UPSTREAM", INT2NUM (ZMQ_UPSTREAM)); - rb_define_global_const ("DOWNSTREAM", INT2NUM (ZMQ_DOWNSTREAM)); - - rb_define_global_const ("POLL", INT2NUM (ZMQ_POLL)); + rb_define_const (zmq_module, "HWM", INT2NUM (ZMQ_HWM)); + rb_define_const (zmq_module, "LWM", INT2NUM (ZMQ_LWM)); + rb_define_const (zmq_module, "SWAP", INT2NUM (ZMQ_SWAP)); + rb_define_const (zmq_module, "AFFINITY", INT2NUM (ZMQ_AFFINITY)); + rb_define_const (zmq_module, "IDENTITY", INT2NUM (ZMQ_IDENTITY)); + rb_define_const (zmq_module, "SUBSCRIBE", INT2NUM (ZMQ_SUBSCRIBE)); + rb_define_const (zmq_module, "UNSUBSCRIBE", INT2NUM (ZMQ_UNSUBSCRIBE)); + rb_define_const (zmq_module, "RATE", INT2NUM (ZMQ_RATE)); + rb_define_const (zmq_module, "RECOVERY_IVL", INT2NUM (ZMQ_RECOVERY_IVL)); + rb_define_const (zmq_module, "MCAST_LOOP", INT2NUM (ZMQ_MCAST_LOOP)); + rb_define_const (zmq_module, "SNDBUF", INT2NUM (ZMQ_SNDBUF)); + rb_define_const (zmq_module, "RCVBUF", INT2NUM (ZMQ_RCVBUF)); + + rb_define_const (zmq_module, "NOBLOCK", INT2NUM (ZMQ_NOBLOCK)); + rb_define_const (zmq_module, "NOFLUSH", INT2NUM (ZMQ_NOFLUSH)); + + rb_define_const (zmq_module, "P2P", INT2NUM (ZMQ_P2P)); + rb_define_const (zmq_module, "SUB", INT2NUM (ZMQ_SUB)); + rb_define_const (zmq_module, "PUB", INT2NUM (ZMQ_PUB)); + rb_define_const (zmq_module, "REQ", INT2NUM (ZMQ_REQ)); + rb_define_const (zmq_module, "REP", INT2NUM (ZMQ_REP)); + rb_define_const (zmq_module, "XREQ", INT2NUM (ZMQ_XREQ)); + rb_define_const (zmq_module, "XREP", INT2NUM (ZMQ_XREP)); + rb_define_const (zmq_module, "UPSTREAM", INT2NUM (ZMQ_UPSTREAM)); + rb_define_const (zmq_module, "DOWNSTREAM", INT2NUM (ZMQ_DOWNSTREAM)); + + rb_define_const (zmq_module, "POLL", INT2NUM (ZMQ_POLL)); } diff --git a/perf/ruby/local_lat.rb b/perf/ruby/local_lat.rb index a299630..b27e8bc 100644 --- a/perf/ruby/local_lat.rb +++ b/perf/ruby/local_lat.rb @@ -27,8 +27,8 @@ bind_to = ARGV[0] message_size = ARGV[1].to_i roundtrip_count = ARGV[2].to_i -ctx = Context.new(1, 1, 0) -s = Socket.new(ctx, REP); +ctx = ZMQ::Context.new(1, 1, 0) +s = ZMQ::Socket.new(ctx, ZMQ::REP); s.bind(bind_to); for i in 0...roundtrip_count do diff --git a/perf/ruby/local_thr.rb b/perf/ruby/local_thr.rb index f1c0fdf..b20ca60 100644 --- a/perf/ruby/local_thr.rb +++ b/perf/ruby/local_thr.rb @@ -27,9 +27,9 @@ bind_to = ARGV[0] message_size = ARGV[1].to_i message_count = ARGV[2].to_i -ctx = Context.new(1, 1, 0) -s = Socket.new(ctx, SUB); -s.setsockopt(SUBSCRIBE, ""); +ctx = ZMQ::Context.new(1, 1, 0) +s = ZMQ::Socket.new(ctx, ZMQ::SUB); +s.setsockopt(ZMQ::SUBSCRIBE, ""); # Add your socket options here. # For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM. diff --git a/perf/ruby/remote_lat.rb b/perf/ruby/remote_lat.rb index 7449aff..ea8cf8e 100644 --- a/perf/ruby/remote_lat.rb +++ b/perf/ruby/remote_lat.rb @@ -27,8 +27,8 @@ connect_to = ARGV[0] message_size = ARGV[1].to_i roundtrip_count = ARGV[2].to_i -ctx = Context.new(1, 1, 0) -s = Socket.new(ctx, REQ); +ctx = ZMQ::Context.new(1, 1, 0) +s = ZMQ::Socket.new(ctx, ZMQ::REQ); s.connect(connect_to); msg = "#{'0'*message_size}" diff --git a/perf/ruby/remote_thr.rb b/perf/ruby/remote_thr.rb index 9edd1c6..b2dada6 100644 --- a/perf/ruby/remote_thr.rb +++ b/perf/ruby/remote_thr.rb @@ -27,8 +27,8 @@ connect_to = ARGV[0] message_size = ARGV[1].to_i message_count = ARGV[2].to_i -ctx = Context.new(1, 1, 0) -s = Socket.new(ctx, PUB); +ctx = ZMQ::Context.new(1, 1, 0) +s = ZMQ::Socket.new(ctx, ZMQ::PUB); # Add your socket options here. # For example ZMQ_RATE, ZMQ_RECOVERY_IVL and ZMQ_MCAST_LOOP for PGM. -- cgit v1.2.3 From 9d8623b28f09f5a6db94c7d69ae264984ef1fbe3 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 17 Feb 2010 08:30:27 +0100 Subject: ZMQII-76: Bug in how replies are handled when the REQ endpoint goes away --- src/rep.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/rep.cpp b/src/rep.cpp index b7685b4..1649e83 100644 --- a/src/rep.cpp +++ b/src/rep.cpp @@ -85,11 +85,11 @@ void zmq::rep_t::xdetach_outpipe (class writer_t *pipe_) out_pipes_t::size_type index = out_pipes.index (pipe_); - // TODO: If the connection we've got the request from disconnects, - // there's nowhere to send the reply. DLQ? - if (waiting_for_reply && pipe_ == reply_pipe) { - zmq_assert (false); - } + // If the connection we've got the request from disconnects, + // there's nowhere to send the reply. Forget about the reply pipe. + // Once the reply is sent it will be dropped. + if (waiting_for_reply && pipe_ == reply_pipe) + reply_pipe = NULL; // If corresponding inpipe is still in place simply nullify the pointer // to the outpipe. @@ -146,9 +146,15 @@ int zmq::rep_t::xsend (zmq_msg_t *msg_, int flags_) // overloads the buffer, connection should be torn down. zmq_assert (reply_pipe->check_write (zmq_msg_size (msg_))); - // Push message to the selected pipe. - reply_pipe->write (msg_); - reply_pipe->flush (); + // Push message to the selected pipe. If requester have disconnected + // in the meantime, drop the reply. + if (reply_pipe) { + reply_pipe->write (msg_); + reply_pipe->flush (); + } + else { + zmq_close (msg_); + } waiting_for_reply = false; reply_pipe = NULL; -- cgit v1.2.3 From f745c96a9bcf930d10fe31de5f7b3e772cccfa83 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Wed, 17 Feb 2010 15:40:26 +0100 Subject: Add POSIX and GNU Feature Test Macros This should fix more exotic POSIX platforms such as HPUX which insist on having _POSIX_C_SOURCE defined to get proper threading behaviour. We also define _GNU_SOURCE so that we get any extensions on systems with glibc, e.g. eventfd. --- configure.in | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/configure.in b/configure.in index 49266c7..a031458 100644 --- a/configure.in +++ b/configure.in @@ -91,10 +91,13 @@ if test ! -f "doc/zmq.html"; then fi fi +# Set some default features required by 0MQ code. +CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L $CPPFLAGS" + +# OS-specific tests case "${host_os}" in *linux*) AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS]) - CPPFLAGS="-D_REENTRANT $CPPFLAGS" AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) ;; @@ -105,7 +108,7 @@ case "${host_os}" in AC_CHECK_LIB(rt, main) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) - CPPFLAGS="-D_REENTRANT -D_PTHREADS $CPPFLAGS" + CPPFLAGS="-D_PTHREADS $CPPFLAGS" AC_MSG_CHECKING([wheter atomic operations can be used]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]], @@ -122,7 +125,6 @@ case "${host_os}" in ;; *freebsd*) AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS]) - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" LIBS="-pthread" ;; *darwin*) @@ -134,26 +136,18 @@ case "${host_os}" in ;; *openbsd*) AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS]) - CPPFLAGS="-pthread $CPPFLAGS" LIBS="-pthread" ;; *nto-qnx*) pedantic="no" AC_DEFINE(ZMQ_HAVE_QNXNTO, 1, [Have QNX Neutrino OS]) - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" AC_CHECK_LIB(socket,main) ;; *aix*) AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS]) - if test "x$GXX" = "xyes"; then - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" - fi ;; *hpux*) AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS]) - if test "x$GXX" = "xyes"; then - CPPFLAGS="-D_THREAD_SAFE $CPPFLAGS" - fi AC_CHECK_LIB(rt, main) ;; *mingw32*) -- cgit v1.2.3 From 41354bfa9820eb4495cf98342177d036df2a7dc7 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Feb 2010 20:16:19 +0100 Subject: zmq_version fixed on Win32 platform --- builds/msvc/platform.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/builds/msvc/platform.hpp b/builds/msvc/platform.hpp index 483f88f..6d59329 100644 --- a/builds/msvc/platform.hpp +++ b/builds/msvc/platform.hpp @@ -25,6 +25,11 @@ // zmq directory to take place of platform.hpp generated from // platform.hpp.in on platforms supported by GNU autotools. +// 0MQ version information +#define PACKAGE_VERSION_MAJOR 2 +#define PACKAGE_VERSION_MINOR 0 +#define PACKAGE_VERSION_PATCH 6 + #define ZMQ_HAVE_WINDOWS #define _WINSOCKAPI_ #define NOMINMAX -- cgit v1.2.3 From e385319e5aaff6deafddfb216b24f026b461caa6 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 17 Feb 2010 20:33:00 +0100 Subject: recv returning -1 while errno=0 fixed --- src/socket_base.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 720e8cd..6f1e5a3 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -331,6 +331,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_) { // Get the message. int rc = xrecv (msg_, flags_); + int err = errno; // Once every inbound_poll_rate messages check for signals and process // incoming commands. This happens only if we are not polling altogether @@ -371,6 +372,7 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_) } } + errno = err; return rc; } -- cgit v1.2.3 From d008637bc42da3fca50e423c2df0736be2745ac7 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 17 Feb 2010 21:16:59 +0100 Subject: one more attempt to fix the previous win32 problem --- src/socket_base.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 6f1e5a3..ef563e5 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -350,30 +350,30 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_) if (rc == 0) return 0; + // If we don't have the message, restore the original cause of the problem. + errno = err; + // If the message cannot be fetched immediately, there are two scenarios. // For non-blocking recv, commands are processed in case there's a revive // command already waiting int a command pipe. If it's not, return EAGAIN. - // In blocking scenario, commands are processed over and over again until - // we are able to fetch a message. if (flags_ & ZMQ_NOBLOCK) { if (errno != EAGAIN) return -1; app_thread->process_commands (false, false); - rc = xrecv (msg_, flags_); ticks = 0; - } - else { - while (rc != 0) { - if (errno != EAGAIN) - return -1; - app_thread->process_commands (true, false); - rc = xrecv (msg_, flags_); - ticks = 0; - } + return xrecv (msg_, flags_); } - errno = err; - return rc; + // In blocking scenario, commands are processed over and over again until + // we are able to fetch a message. + while (rc != 0) { + if (errno != EAGAIN) + return -1; + app_thread->process_commands (true, false); + rc = xrecv (msg_, flags_); + ticks = 0; + } + return 0; } int zmq::socket_base_t::close () -- cgit v1.2.3 From 8be491b7bdb8525eb37cebf355697c566a482e2d Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 18 Feb 2010 13:46:00 +0100 Subject: Use feature test macros more conservatively It turns out that feature test macros are a complete mess, and defining _GNU_SOURCE and _POSIX_C_SOURCE together breaks some systems. So we try and define the appropriate "make everything visible" combination specific to each system instead. This may still break something, so people should test their platforms and speak up if so. --- configure.in | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index a031458..d43f941 100644 --- a/configure.in +++ b/configure.in @@ -92,23 +92,26 @@ if test ! -f "doc/zmq.html"; then fi # Set some default features required by 0MQ code. -CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE -D_POSIX_C_SOURCE=200112L $CPPFLAGS" +CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS" # OS-specific tests case "${host_os}" in *linux*) + # Define on Linux to enable all library features + CPPFLAGS="-D_GNU_SOURCE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_LINUX, 1, [Have Linux OS]) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) ;; *solaris*) + # Define on Solaris to enable all library features + CPPFLAGS="-D_POSIX_C_SOURCE=200112L -D_PTHREADS $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_SOLARIS, 1, [Have Solaris OS]) AC_CHECK_LIB(socket, main) AC_CHECK_LIB(nsl, main) AC_CHECK_LIB(rt, main) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) - CPPFLAGS="-D_PTHREADS $CPPFLAGS" AC_MSG_CHECKING([wheter atomic operations can be used]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]], @@ -124,10 +127,14 @@ case "${host_os}" in fi ;; *freebsd*) + # Define on FreeBSD to enable all library features + CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS]) LIBS="-pthread" ;; *darwin*) + # Define on Darwin to enable all library features + CPPFLAGS="-D_DARWIN_C_SOURCE $CPPFLAGS" pedantic="no" werror="no" AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS]) @@ -135,6 +142,8 @@ case "${host_os}" in LIBZMQ_EXTRA_CXXFLAGS+="-Wno-uninitialized" ;; *openbsd*) + # Define on OpenBSD to enable all library features + CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS]) LIBS="-pthread" ;; @@ -147,6 +156,8 @@ case "${host_os}" in AC_DEFINE(ZMQ_HAVE_AIX, 1, [Have AIX OS]) ;; *hpux*) + # Define on HP-UX to enable all library features + CPPFLAGS="-D_POSIX_C_SOURCE=200112L" AC_DEFINE(ZMQ_HAVE_HPUX, 1, [Have HPUX OS]) AC_CHECK_LIB(rt, main) ;; -- cgit v1.2.3 From 46824abeb2b016c51f406401d965816f71189aed Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 18 Feb 2010 17:25:49 +0100 Subject: Never build docs from tarball releases This fixes the build_doc logic to work as advertised and never try to (re)build documentation when working with a tarball release. --- configure.in | 14 +++++++++++--- doc/Makefile.am | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in index d43f941..45def38 100644 --- a/configure.in +++ b/configure.in @@ -77,9 +77,9 @@ on_mingw32="no" AC_CANONICAL_HOST # Determine whether or not documentation should be built. -build_doc="yes" +build_doc="no" install_man="yes" -if test ! -f "doc/zmq.html"; then +if test -d ".git"; then # We are building from git. # Check for asciidoc and xmlto and don't build the docs if these are not installed. AC_CHECK_PROG(have_asciidoc, asciidoc, yes, no) @@ -88,8 +88,17 @@ if test ! -f "doc/zmq.html"; then build_doc="no" install_man="no" AC_MSG_WARN([You are building from git and asciidoc is not installed. Documentation will not be built or installed.]) + else + build_doc="yes" fi fi +AC_MSG_CHECKING([whether to build documentation]) +AC_MSG_RESULT([$build_doc]) +AC_MSG_CHECKING([whether to install manpages]) +if test ! -f "./doc/zmq.7"; then + AC_MSG_ERROR([configure thinks we want to install manpages but they're not present. Help!]) +fi +AC_MSG_RESULT([$install_man]) # Set some default features required by 0MQ code. CPPFLAGS="-D_REENTRANT -D_THREAD_SAFE $CPPFLAGS" @@ -639,7 +648,6 @@ AC_MSG_RESULT([ Queue: $queue]) AC_MSG_RESULT([ Performance tests: $perf]) AC_MSG_RESULT([ Examples:]) AC_MSG_RESULT([ Chat: $chat]) -AC_MSG_RESULT([ Documentation: $build_doc]) AC_MSG_RESULT([]) AC_MSG_RESULT([ ******************************************************** ]) AC_MSG_RESULT([]) diff --git a/doc/Makefile.am b/doc/Makefile.am index c91c808..a6fce0c 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -26,6 +26,7 @@ MAINTAINERCLEANFILES = $(MAN_DOC) $(MAN_HTML) dist-hook : $(MAN_DOC) $(MAN_HTML) +if BUILD_DOC SUFFIXES=.html .txt .xml .1 .3 .7 .txt.html: @@ -40,4 +41,4 @@ SUFFIXES=.html .txt .xml .1 .3 .7 xmlto man $< .xml.7: xmlto man $< - +endif -- cgit v1.2.3 From 495f0d105f809a265c34aa9a0eb20af0dcdcf283 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 18 Feb 2010 17:29:14 +0100 Subject: Fix detection of libstdc++ We only care about libstdc++ when using GNU C++. Further, libstdc++ depends on libm on some platforms, fix this. --- configure.in | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.in b/configure.in index 45def38..7fbc2cf 100644 --- a/configure.in +++ b/configure.in @@ -55,8 +55,12 @@ AC_PROG_SED AC_PROG_AWK # Checks for libraries. -AC_CHECK_LIB(pthread, pthread_create) -AC_CHECK_LIB(stdc++, malloc) +AC_CHECK_LIB([pthread], [pthread_create]) +# If using GNU C++, libstdc++ must be available. +if test "x$GXX" = "xyes"; then + AC_CHECK_LIB([stdc++], [main], , + [AC_MSG_ERROR([cannot link with -lstdc++])], [-lm]) +fi # Extra CXXFLAGS are appended at the end of CXXFLAGS for libzmq. LIBZMQ_EXTRA_CXXFLAGS="" @@ -139,7 +143,6 @@ case "${host_os}" in # Define on FreeBSD to enable all library features CPPFLAGS="-D__BSD_VISIBLE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_FREEBSD, 1, [Have FreeBSD OS]) - LIBS="-pthread" ;; *darwin*) # Define on Darwin to enable all library features @@ -147,14 +150,12 @@ case "${host_os}" in pedantic="no" werror="no" AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS]) - LIBS="-pthread" LIBZMQ_EXTRA_CXXFLAGS+="-Wno-uninitialized" ;; *openbsd*) # Define on OpenBSD to enable all library features CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" AC_DEFINE(ZMQ_HAVE_OPENBSD, 1, [Have OpenBSD OS]) - LIBS="-pthread" ;; *nto-qnx*) pedantic="no" -- cgit v1.2.3 From ab27f84b14a317d78a9dd145ef5c82e0ef88f583 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 18 Feb 2010 19:27:15 +0100 Subject: libstdc++ depends on libm on some platforms --- configure.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 7fbc2cf..da7f0b1 100644 --- a/configure.in +++ b/configure.in @@ -58,8 +58,10 @@ AC_PROG_AWK AC_CHECK_LIB([pthread], [pthread_create]) # If using GNU C++, libstdc++ must be available. if test "x$GXX" = "xyes"; then + # libstdc++ depends on libm on some platforms + AC_CHECK_LIB([m], [main]) AC_CHECK_LIB([stdc++], [main], , - [AC_MSG_ERROR([cannot link with -lstdc++])], [-lm]) + [AC_MSG_ERROR([cannot link with -lstdc++])]) fi # Extra CXXFLAGS are appended at the end of CXXFLAGS for libzmq. -- cgit v1.2.3 From 776b12633981fd95050e138daeeba00a65d9532b Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 18 Feb 2010 19:27:35 +0100 Subject: Fix typo --- configure.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.in b/configure.in index da7f0b1..314372a 100644 --- a/configure.in +++ b/configure.in @@ -127,7 +127,7 @@ case "${host_os}" in AC_CHECK_LIB(rt, main) AC_CHECK_LIB(uuid, main, , [AC_MSG_ERROR([cannot link with -luuid, install uuid-dev.])]) - AC_MSG_CHECKING([wheter atomic operations can be used]) + AC_MSG_CHECKING([whether atomic operations can be used]) AC_COMPILE_IFELSE([AC_LANG_PROGRAM( [[#include ]], [[uint32_t value; -- cgit v1.2.3 From 2a79a943de417679c562cd4a917e1d1bc19b0d25 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Thu, 18 Feb 2010 19:38:15 +0100 Subject: Add NetBSD support --- configure.in | 13 +++++++++++++ src/atomic_bitmap.hpp | 16 ++++++++-------- src/atomic_counter.hpp | 14 +++++++------- src/atomic_ptr.hpp | 14 +++++++------- src/ip.cpp | 11 ++--------- src/ip.hpp | 10 ++++++++++ src/kqueue.cpp | 17 ++++++++++++++--- src/kqueue.hpp | 3 ++- src/poll.cpp | 3 ++- src/poll.hpp | 3 ++- src/poller.hpp | 2 ++ src/tcp_listener.cpp | 2 +- src/uuid.cpp | 2 +- src/uuid.hpp | 4 ++-- src/zmq.cpp | 6 ++++-- 15 files changed, 77 insertions(+), 43 deletions(-) diff --git a/configure.in b/configure.in index 314372a..20cd8c5 100644 --- a/configure.in +++ b/configure.in @@ -154,6 +154,19 @@ case "${host_os}" in AC_DEFINE(ZMQ_HAVE_OSX, 1, [Have DarwinOSX OS]) LIBZMQ_EXTRA_CXXFLAGS+="-Wno-uninitialized" ;; + *netbsd*) + # Define on NetBSD to enable all library features + CPPFLAGS="-D_NETBSD_SOURCE $CPPFLAGS" + AC_DEFINE(ZMQ_HAVE_NETBSD, 1, [Have NetBSD OS]) + # NetBSD 5.0 and newer provides atomic operations + netbsd_has_atomic=no + # XXX As of 5.0.1 the functions declared in atomic.h are + # missing "extern C", disable this until upstream fixes it. + # AC_CHECK_HEADERS(atomic.h, [netbsd_has_atomic=yes]) + if test "x$netbsd_has_atomic" = "xno"; then + AC_DEFINE(ZMQ_FORCE_MUTEXES, 1, [Force to use mutexes]) + fi + ;; *openbsd*) # Define on OpenBSD to enable all library features CPPFLAGS="-D_BSD_SOURCE $CPPFLAGS" diff --git a/src/atomic_bitmap.hpp b/src/atomic_bitmap.hpp index 6620f06..1aefd27 100644 --- a/src/atomic_bitmap.hpp +++ b/src/atomic_bitmap.hpp @@ -34,8 +34,8 @@ #define ZMQ_ATOMIC_BITMAP_SPARC #elif defined ZMQ_HAVE_WINDOWS #define ZMQ_ATOMIC_BITMAP_WINDOWS -#elif defined ZMQ_HAVE_SOLARIS -#define ZMQ_ATOMIC_BITMAP_SOLARIS +#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD) +#define ZMQ_ATOMIC_BITMAP_SYSTEM #else #define ZMQ_ATOMIC_BITMAP_MUTEX #endif @@ -44,7 +44,7 @@ #include "mutex.hpp" #elif defined ZMQ_ATOMIC_BITMAP_WINDOWS #include "windows.hpp" -#elif defined ZMQ_ATOMIC_BITMAP_SOLARIS +#elif defined ZMQ_ATOMIC_BITMAP_SYSTEM #include #endif @@ -89,7 +89,7 @@ namespace zmq return (oldval & (bitmap_t (1) << reset_index_)) ? true : false; } -#elif defined ZMQ_ATOMIC_BITMAP_SOLARIS +#elif defined ZMQ_ATOMIC_BITMAP_SYSTEM while (true) { bitmap_t oldval = value; bitmap_t newval = (oldval | (bitmap_t (1) << set_index_)) & @@ -150,7 +150,7 @@ namespace zmq bitmap_t oldval; #if defined ZMQ_ATOMIC_BITMAP_WINDOWS oldval = InterlockedExchange ((volatile LONG*) &value, newval_); -#elif defined ZMQ_ATOMIC_BITMAP_SOLARIS +#elif defined ZMQ_ATOMIC_BITMAP_SYSTEM oldval = atomic_swap_32 (&value, newval_); #elif defined ZMQ_ATOMIC_BITMAP_X86 oldval = newval_; @@ -201,7 +201,7 @@ namespace zmq newval, oldval) == (LONG) oldval) return oldval; } -#elif defined ZMQ_ATOMIC_BITMAP_SOLARIS +#elif defined ZMQ_ATOMIC_BITMAP_SYSTEM while (true) { bitmap_t oldval = value; bitmap_t newval = oldval == 0 ? thenval_ : elseval_; @@ -270,8 +270,8 @@ namespace zmq #if defined ZMQ_ATOMIC_BITMAP_WINDOWS #undef ZMQ_ATOMIC_BITMAP_WINDOWS #endif -#if defined ZMQ_ATOMIC_BITMAP_SOLARIS -#undef ZMQ_ATOMIC_BITMAP_SOLARIS +#if defined ZMQ_ATOMIC_BITMAP_SYSTEM +#undef ZMQ_ATOMIC_BITMAP_SYSTEM #endif #if defined ZMQ_ATOMIC_BITMAP_X86 #undef ZMQ_ATOMIC_BITMAP_X86 diff --git a/src/atomic_counter.hpp b/src/atomic_counter.hpp index 649fdbf..4a77928 100644 --- a/src/atomic_counter.hpp +++ b/src/atomic_counter.hpp @@ -31,8 +31,8 @@ #define ZMQ_ATOMIC_COUNTER_SPARC #elif defined ZMQ_HAVE_WINDOWS #define ZMQ_ATOMIC_COUNTER_WINDOWS -#elif defined ZMQ_HAVE_SOLARIS -#define ZMQ_ATOMIC_COUNTER_SOLARIS +#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD) +#define ZMQ_ATOMIC_COUNTER_SYSTEM #else #define ZMQ_ATOMIC_COUNTER_MUTEX #endif @@ -41,7 +41,7 @@ #include "mutex.hpp" #elif defined ZMQ_ATOMIC_COUNTER_WINDOWS #include "windows.hpp" -#elif defined ZMQ_ATOMIC_COUNTER_SOLARIS +#elif defined ZMQ_ATOMIC_COUNTER_SYSTEM #include #endif @@ -79,7 +79,7 @@ namespace zmq #if defined ZMQ_ATOMIC_COUNTER_WINDOWS old_value = InterlockedExchangeAdd ((LONG*) &value, increment_); -#elif defined ZMQ_ATOMIC_COUNTER_SOLARIS +#elif defined ZMQ_ATOMIC_COUNTER_SYSTEM integer_t new_value = atomic_add_32_nv (&value, increment_); old_value = new_value - increment_; #elif defined ZMQ_ATOMIC_COUNTER_X86 @@ -119,7 +119,7 @@ namespace zmq LONG delta = - ((LONG) decrement); integer_t old = InterlockedExchangeAdd ((LONG*) &value, delta); return old - decrement != 0; -#elif defined ZMQ_ATOMIC_COUNTER_SOLARIS +#elif defined ZMQ_ATOMIC_COUNTER_SYSTEM int32_t delta = - ((int32_t) decrement); integer_t nv = atomic_add_32_nv (&value, delta); return nv != 0; @@ -180,8 +180,8 @@ namespace zmq #if defined ZMQ_ATOMIC_COUNTER_WINDOWS #undef ZMQ_ATOMIC_COUNTER_WINDOWS #endif -#if defined ZMQ_ATOMIC_COUNTER_SOLARIS -#undef ZMQ_ATOMIC_COUNTER_SOLARIS +#if defined ZMQ_ATOMIC_COUNTER_SYSTEM +#undef ZMQ_ATOMIC_COUNTER_SYSTEM #endif #if defined ZMQ_ATOMIC_COUNTER_X86 #undef ZMQ_ATOMIC_COUNTER_X86 diff --git a/src/atomic_ptr.hpp b/src/atomic_ptr.hpp index 3735e99..e4a7491 100644 --- a/src/atomic_ptr.hpp +++ b/src/atomic_ptr.hpp @@ -31,8 +31,8 @@ #define ZMQ_ATOMIC_PTR_SPARC #elif defined ZMQ_HAVE_WINDOWS #define ZMQ_ATOMIC_PTR_WINDOWS -#elif defined ZMQ_HAVE_SOLARIS -#define ZMQ_ATOMIC_PTR_SOLARIS +#elif (defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_NETBSD) +#define ZMQ_ATOMIC_PTR_SYSTEM #else #define ZMQ_ATOMIC_PTR_MUTEX #endif @@ -41,7 +41,7 @@ #include "mutex.hpp" #elif defined ZMQ_ATOMIC_PTR_WINDOWS #include "windows.hpp" -#elif defined ZMQ_ATOMIC_PTR_SOLARIS +#elif defined ZMQ_ATOMIC_PTR_SYSTEM #include #endif @@ -79,7 +79,7 @@ namespace zmq { #if defined ZMQ_ATOMIC_PTR_WINDOWS return (T*) InterlockedExchangePointer (&ptr, val_); -#elif defined ZMQ_ATOMIC_PTR_SOLARIS +#elif defined ZMQ_ATOMIC_PTR_SYSTEM return (T*) atomic_swap_ptr (&ptr, val_); #elif defined ZMQ_ATOMIC_PTR_X86 T *old; @@ -125,7 +125,7 @@ namespace zmq #if defined ZMQ_ATOMIC_PTR_WINDOWS return (T*) InterlockedCompareExchangePointer ( (volatile PVOID*) &ptr, val_, cmp_); -#elif defined ZMQ_ATOMIC_PTR_SOLARIS +#elif defined ZMQ_ATOMIC_PTR_SYSTEM return (T*) atomic_cas_ptr (&ptr, cmp_, val_); #elif defined ZMQ_ATOMIC_PTR_X86 T *old; @@ -173,8 +173,8 @@ namespace zmq #if defined ZMQ_ATOMIC_PTR_WINDOWS #undef ZMQ_ATOMIC_PTR_WINDOWS #endif -#if defined ZMQ_ATOMIC_PTR_SOLARIS -#undef ZMQ_ATOMIC_PTR_SOLARIS +#if defined ZMQ_ATOMIC_PTR_SYSTEM +#undef ZMQ_ATOMIC_PTR_SYSTEM #endif #if defined ZMQ_ATOMIC_PTR_X86 #undef ZMQ_ATOMIC_PTR_X86 diff --git a/src/ip.cpp b/src/ip.cpp index 822e359..b3ad610 100644 --- a/src/ip.cpp +++ b/src/ip.cpp @@ -125,7 +125,8 @@ static int resolve_nic_name (in_addr* addr_, char const *interface_) #elif ((defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_OPENBSD ||\ - defined ZMQ_HAVE_QNXNTO) && defined ZMQ_HAVE_IFADDRS) + defined ZMQ_HAVE_QNXNTO || defined ZMQ_HAVE_NETBSD)\ + && defined ZMQ_HAVE_IFADDRS) #include @@ -239,11 +240,7 @@ int zmq::resolve_ip_interface (sockaddr_storage* addr_, socklen_t *addr_len_, // Restrict hostname/service to literals to avoid any DNS lookups or // service-name irregularity due to indeterminate socktype. -#if defined ZMQ_HAVE_OSX - req.ai_flags = AI_PASSIVE | AI_NUMERICHOST; -#else req.ai_flags = AI_PASSIVE | AI_NUMERICHOST | AI_NUMERICSERV; -#endif // Resolve the literal address. Some of the error info is lost in case // of error, however, there's no way to report EAI errors via errno. @@ -292,11 +289,7 @@ int zmq::resolve_ip_hostname (sockaddr_storage *addr_, socklen_t *addr_len_, // Avoid named services due to unclear socktype, and don't pick IPv6 // addresses if we don't have a local IPv6 address configured. -#if defined ZMQ_HAVE_OSX - req.ai_flags = AI_ADDRCONFIG; -#else req.ai_flags = AI_NUMERICSERV | AI_ADDRCONFIG; -#endif // Resolve host name. Some of the error info is lost in case of error, // however, there's no way to report EAI errors via errno. diff --git a/src/ip.hpp b/src/ip.hpp index 9d9f5c0..ffab2f2 100644 --- a/src/ip.hpp +++ b/src/ip.hpp @@ -30,6 +30,16 @@ #include #include #include + +// Some platforms (notably Darwin/OSX and NetBSD) do not define all AI_ +// flags for getaddrinfo(). This can be worked around safely by defining +// these to 0. +#ifndef AI_ADDRCONFIG +#define AI_ADDRCONFIG 0 +#endif +#ifndef AI_NUMERICSERV +#define AI_NUMERICSERV 0 +#endif #endif #if !defined ZMQ_HAVE_WINDOWS && !defined ZMQ_HAVE_OPENVMS diff --git a/src/kqueue.cpp b/src/kqueue.cpp index bf9c8a2..e1fe2fa 100644 --- a/src/kqueue.cpp +++ b/src/kqueue.cpp @@ -19,7 +19,8 @@ #include "platform.hpp" -#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX +#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD ||\ + defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_NETBSD #include #include @@ -34,6 +35,14 @@ #include "config.hpp" #include "i_poll_events.hpp" +// NetBSD defines (struct kevent).udata as intptr_t, everyone else +// as void *. +#if defined ZMQ_HAVE_NETBSD +#define kevent_udata_t intptr_t +#else +#define kevent_udata_t void * +#endif + zmq::kqueue_t::kqueue_t () : stopping (false) { @@ -56,7 +65,7 @@ void zmq::kqueue_t::kevent_add (fd_t fd_, short filter_, void *udata_) { struct kevent ev; - EV_SET (&ev, fd_, filter_, EV_ADD, 0, 0, udata_); + EV_SET (&ev, fd_, filter_, EV_ADD, 0, 0, (kevent_udata_t)udata_); int rc = kevent (kqueue_fd, &ev, 1, NULL, 0, NULL); errno_assert (rc != -1); } @@ -65,7 +74,7 @@ void zmq::kqueue_t::kevent_delete (fd_t fd_, short filter_) { struct kevent ev; - EV_SET (&ev, fd_, filter_, EV_DELETE, 0, 0, NULL); + EV_SET (&ev, fd_, filter_, EV_DELETE, 0, 0, (kevent_udata_t)NULL); int rc = kevent (kqueue_fd, &ev, 1, NULL, 0, NULL); errno_assert (rc != -1); } @@ -212,4 +221,6 @@ void zmq::kqueue_t::worker_routine (void *arg_) ((kqueue_t*) arg_)->loop (); } +// Don't pollute namespace with defines local to this file +#undef kevent_udata_t #endif diff --git a/src/kqueue.hpp b/src/kqueue.hpp index d2dd09a..ac28a7d 100644 --- a/src/kqueue.hpp +++ b/src/kqueue.hpp @@ -22,7 +22,8 @@ #include "platform.hpp" -#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX +#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_OPENBSD ||\ + defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_NETBSD #include diff --git a/src/poll.cpp b/src/poll.cpp index 889ea4a..4214195 100644 --- a/src/poll.cpp +++ b/src/poll.cpp @@ -22,7 +22,8 @@ #if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\ - defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX + defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\ + defined ZMQ_HAVE_NETBSD #include #include diff --git a/src/poll.hpp b/src/poll.hpp index 5b8e745..f4ae35a 100644 --- a/src/poll.hpp +++ b/src/poll.hpp @@ -25,7 +25,8 @@ #if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\ - defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX + defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\ + defined ZMQ_HAVE_NETBSD #include #include diff --git a/src/poller.hpp b/src/poller.hpp index b769283..49d466b 100644 --- a/src/poller.hpp +++ b/src/poller.hpp @@ -47,6 +47,8 @@ namespace zmq typedef kqueue_t poller_t; #elif defined ZMQ_HAVE_OPENBSD typedef kqueue_t poller_t; +#elif defined ZMQ_HAVE_NETBSD + typedef kqueue_t poller_t; #elif defined ZMQ_HAVE_SOLARIS typedef devpoll_t poller_t; #elif defined ZMQ_HAVE_OSX diff --git a/src/tcp_listener.cpp b/src/tcp_listener.cpp index 3d15abe..cb84715 100644 --- a/src/tcp_listener.cpp +++ b/src/tcp_listener.cpp @@ -275,7 +275,7 @@ zmq::fd_t zmq::tcp_listener_t::accept () #if (defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD || \ defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_OSX || \ - defined ZMQ_HAVE_OPENVMS) + defined ZMQ_HAVE_OPENVMS || defined ZMQ_HAVE_NETBSD) if (sock == -1 && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR || errno == ECONNABORTED)) diff --git a/src/uuid.cpp b/src/uuid.cpp index 6fdb060..fa1cff4 100644 --- a/src/uuid.cpp +++ b/src/uuid.cpp @@ -47,7 +47,7 @@ const char *zmq::uuid_t::to_string () return (char*) uuid_str; } -#elif defined ZMQ_HAVE_FREEBSD +#elif defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD #include #include diff --git a/src/uuid.hpp b/src/uuid.hpp index 001ea94..00424ed 100644 --- a/src/uuid.hpp +++ b/src/uuid.hpp @@ -23,7 +23,7 @@ #include "platform.hpp" #include "stdint.hpp" -#if defined ZMQ_HAVE_FREEBSD +#if defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD #include #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX #include @@ -60,7 +60,7 @@ namespace zmq #endif ::UUID uuid; RPC_CSTR uuid_str; -#elif defined ZMQ_HAVE_FREEBSD +#elif defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_NETBSD ::uuid_t uuid; char *uuid_str; #elif defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OSX diff --git a/src/zmq.cpp b/src/zmq.cpp index e6f1a61..4170b3f 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -37,7 +37,8 @@ #if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\ - defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX + defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\ + defined ZMQ_HAVE_NETBSD #include #endif @@ -325,7 +326,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_) #if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_FREEBSD ||\ defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_SOLARIS ||\ defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_QNXNTO ||\ - defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX + defined ZMQ_HAVE_HPUX || defined ZMQ_HAVE_AIX ||\ + defined ZMQ_HAVE_NETBSD pollfd *pollfds = (pollfd*) malloc (nitems_ * sizeof (pollfd)); zmq_assert (pollfds); -- cgit v1.2.3