with the attachment it's better :-)

On Fri, May 20, 2016 at 06:37:05AM +0200, Willy Tarreau wrote:
> Hi Jonathan,
> 
> On Wed, May 18, 2016 at 01:52:01PM -0400, Jonathan Fisher wrote:
> > Nice!!!! here's the complication output:
> > 
> > 
> > http://pastebin.com/iS2JKXED
> > 
> > Now I just have to figure out how to add openssl, zlib, and libpcre which
> > don't seem to be available on Oracle Solaris.
> 
> Normally it should also work with the attached patch which I'd prefer to
> merge for long-term safety.
> 
> Regarding the other packages you need above, when I was working on Solaris
> I used to pick them from sunfreeware.com, they used to work out of the box.
> 
> Regards,
> Willy
>From 594e0f0083b67c6bc130bf54211246c734f229ed Mon Sep 17 00:00:00 2001
From: Willy Tarreau <w...@1wt.eu>
Date: Fri, 20 May 2016 06:29:59 +0200
Subject: BUILD: fix build on Solaris 11

htonll()/ntohll() already exist on Solaris 11 with a different declaration,
causing a build error as reported by Jonathan Fisher. They used to exist on
OSX with a #define which allowed us to detect them. It was a bad idea to give
these functions a name subject to conflicts like this. Simply rename them
my_htonll()/my_ntohll() to definitely get rid of the conflict.

This patch must be backported to 1.6.
---
 include/common/standard.h | 10 +++-------
 src/sample.c              |  2 +-
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/include/common/standard.h b/include/common/standard.h
index f123f1a..8711ede 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -1048,8 +1048,7 @@ static inline unsigned char utf8_return_length(unsigned 
char code)
  * the whole code is optimized out. In little endian, with a decent compiler,
  * a few bswap and 2 shifts are left, which is the minimum acceptable.
  */
-#ifndef htonll
-static inline unsigned long long htonll(unsigned long long a)
+static inline unsigned long long my_htonll(unsigned long long a)
 {
        union {
                struct {
@@ -1060,15 +1059,12 @@ static inline unsigned long long htonll(unsigned long 
long a)
        } w = { .by64 = a };
        return ((unsigned long long)htonl(w.by32.w1) << 32) | htonl(w.by32.w2);
 }
-#endif
 
 /* Turns 64-bit value <a> from network byte order to host byte order. */
-#ifndef ntohll
-static inline unsigned long long ntohll(unsigned long long a)
+static inline unsigned long long my_ntohll(unsigned long long a)
 {
-       return htonll(a);
+       return my_htonll(a);
 }
-#endif
 
 /* returns a 64-bit a timestamp with the finest resolution available. The
  * unit is intentionally not specified. It's mostly used to compare dates.
diff --git a/src/sample.c b/src/sample.c
index 4f89bab..9e6baa8 100644
--- a/src/sample.c
+++ b/src/sample.c
@@ -765,7 +765,7 @@ static int c_int2bin(struct sample *smp)
 {
        struct chunk *chk = get_trash_chunk();
 
-       *(unsigned long long int *)chk->str = htonll(smp->data.u.sint);
+       *(unsigned long long int *)chk->str = my_htonll(smp->data.u.sint);
        chk->len = 8;
 
        smp->data.u.str = *chk;
-- 
2.8.0.rc2.1.gbe9624a

Reply via email to