From e954cb49732facaa627dff617d214a5b5cab90e5 Mon Sep 17 00:00:00 2001 From: AJ Lewis Date: Tue, 17 Jan 2012 10:33:55 -0600 Subject: [PATCH 1/2] Change peer_identity_size (in all cases) in the command_t structure to be a size_t instead of an unsigned char. The peer_identity_size field in the attach and bind substructure is used to generate a C++ base_string object from an unsigned char *, and that object expects a size_t, not an unsigned char. If an unsigned char is used, the HPUX aCC compiler gets confused and can't figure out which constructor to use. Signed-off-by: AJ Lewis --- src/command.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/command.hpp b/src/command.hpp index 35aed0f..49f5642 100644 --- a/src/command.hpp +++ b/src/command.hpp @@ -72,7 +72,7 @@ namespace zmq // session that the connection have failed. struct { struct i_engine *engine; - unsigned char peer_identity_size; + size_t peer_identity_size; unsigned char *peer_identity; } attach; @@ -81,7 +81,7 @@ namespace zmq struct { class reader_t *in_pipe; class writer_t *out_pipe; - unsigned char peer_identity_size; + size_t peer_identity_size; unsigned char *peer_identity; } bind; From 2b148acd46db833b8c2b880622d0f77bb5e1d89c Mon Sep 17 00:00:00 2001 From: AJ Lewis Date: Tue, 17 Jan 2012 11:20:32 -0600 Subject: [PATCH 2/2] Patch from Mikko Koppanen for #LIBZMQ-301 Add the '-Ae' flag when using aCC Check if CLOCK_MONOTONIC defined before using it - if not, use gethrtime() Signed-off-by: AJ Lewis --- configure.in | 2 ++ src/clock.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index bdff0cf..7c4298f 100644 --- a/configure.in +++ b/configure.in @@ -187,6 +187,8 @@ case "${host_os}" in AS_IF([test "x$with_dce" != xno], [AC_CHECK_LIB(dcekt, uuid_create)], [AC_CHECK_LIB(crypto, RAND_bytes)]) + LIBZMQ_CHECK_LANG_FLAG_PREPEND([-Ae]) + AC_CHECK_FUNCS(gethrtime) ;; *mingw32*) AC_DEFINE(ZMQ_HAVE_WINDOWS, 1, [Have Windows OS]) diff --git a/src/clock.cpp b/src/clock.cpp index f1da091..9bf8f69 100644 --- a/src/clock.cpp +++ b/src/clock.cpp @@ -34,7 +34,7 @@ #include #endif -#if defined HAVE_CLOCK_GETTIME +#if defined HAVE_CLOCK_GETTIME || defined HAVE_GETHRTIME #include #endif @@ -65,7 +65,7 @@ uint64_t zmq::clock_t::now_us () double ticks_div = (double) (ticksPerSecond.QuadPart / 1000000); return (uint64_t) (tick.QuadPart / ticks_div); -#elif defined HAVE_CLOCK_GETTIME +#elif defined HAVE_CLOCK_GETTIME && defined CLOCK_MONOTONIC // Use POSIX clock_gettime function to get precise monotonic time. struct timespec tv; @@ -73,6 +73,10 @@ uint64_t zmq::clock_t::now_us () errno_assert (rc == 0); return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_nsec / 1000); +#elif defined HAVE_GETHRTIME + + return (gethrtime () / 1000); + #else // Use POSIX gettimeofday function to get precise time.