Attached is a patch required to get the selftest working for czmq on
AIX, HP-UX and SunOS (Solaris 10 Sparc).

I've also sent a pull request.

Regards,
-- 
AJ Lewis
Software Engineer
Quantum Corporation

Work:    651 688-4346

----------------------------------------------------------------------
The information contained in this transmission may be confidential. Any 
disclosure, copying, or further distribution of confidential information is not 
permitted unless such privilege is explicitly granted in writing by Quantum. 
Quantum reserves the right to have electronic communications, including email 
and attachments, sent across its networks filtered through anti virus and spam 
software programs and retain such messages in order to comply with applicable 
data security and retention requirements. Quantum is not responsible for the 
proper and complete transmission of the substance of this communication or for 
any delay in its receipt.
>From 3e7fc85a616e59b01058171962ef0890f398c94d Mon Sep 17 00:00:00 2001
From: AJ Lewis <[email protected]>
Date: Wed, 9 Nov 2011 14:22:53 -0600
Subject: [PATCH] AIX, HP-UX, and SunOS needs to use rand() rather than
 random()
Status: RO
Content-Length: 1490
Lines: 36

The selftest for zhash was failing on these platforms because random()
returns up to 2^31-1 and RAND_MAX is set to 2^15-1.  Because of this,
the random index picked in the selftest by randof() was overflowing
the array.

Also, ifaddrs.h does not exist on these platforms

Signed-off-by: AJ Lewis <[email protected]>
---
 include/czmq_prelude.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/czmq_prelude.h b/include/czmq_prelude.h
index 7197ca2..264c414 100644
--- a/include/czmq_prelude.h
+++ b/include/czmq_prelude.h
@@ -304,7 +304,7 @@
 #   include <sys/file.h>
 #   include <sys/wait.h>
 #   include <netinet/in.h>              //  Must come before arpa/inet.h
-#   if (!defined (__UTYPE_ANDROID))
+#   if (!defined (__UTYPE_ANDROID)) && (!defined (__UTYPE_IBMAIX)) && (!defined (__UTYPE_HPUX)) && (!defined (__UTYPE_SUNOS))
 #       include <ifaddrs.h>
 #   endif
 #   if (!defined (__UTYPE_BEOS))
@@ -402,7 +402,7 @@ typedef unsigned int    qbyte;          //  Quad byte = 32 bits
 #define tblsize(x)      (sizeof (x) / sizeof ((x) [0]))
 #define tbllast(x)      (x [tblsize (x) - 1])
 //  Provide random number from 0..(num-1)
-#if (defined (__WINDOWS__))
+#if (defined (__WINDOWS__)) || (defined (__UTYPE_IBMAIX)) || (defined (__UTYPE_HPUX)) || (defined (__UTYPE_SUNOS))
 #   define randof(num)  (int) ((float) (num) * rand () / (RAND_MAX + 1.0))
 #else
 #   define randof(num)  (int) ((float) (num) * random () / (RAND_MAX + 1.0))
-- 
1.7.7

_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to