zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r1679951 - in /zookeeper/trunk: CHANGES.txt src/c/Makefile.am src/c/configure.ac src/c/src/zk_log.c src/c/src/zookeeper.c src/c/tests/LibCMocks.cc src/c/tests/wrappers.opt
Date Mon, 18 May 2015 07:35:51 GMT
Author: rgs
Date: Mon May 18 07:35:50 2015
New Revision: 1679951

URL: http://svn.apache.org/r1679951
Log:
ZOOKEEPER-1077: C client lib doesn't build on Solaris (Chris Nauroth via rgs)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/c/Makefile.am
    zookeeper/trunk/src/c/configure.ac
    zookeeper/trunk/src/c/src/zk_log.c
    zookeeper/trunk/src/c/src/zookeeper.c
    zookeeper/trunk/src/c/tests/LibCMocks.cc
    zookeeper/trunk/src/c/tests/wrappers.opt

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Mon May 18 07:35:50 2015
@@ -99,6 +99,8 @@ BUGFIXES:
   ZOOKEEPER-2190 In StandaloneDisabledTest, testReconfig() shouldn't take
   leaving servers as joining servers (Hongchao Deng via rgs)
 
+  ZOOKEEPER-1077: C client lib doesn't build on Solaris (Chris Nauroth via rgs)
+
 IMPROVEMENTS:
   ZOOKEEPER-1660 Documentation for Dynamic Reconfiguration (Reed Wanderman-Milne via shralex)
 
 

Modified: zookeeper/trunk/src/c/Makefile.am
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/Makefile.am?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/src/c/Makefile.am (original)
+++ zookeeper/trunk/src/c/Makefile.am Mon May 18 07:35:50 2015
@@ -2,11 +2,15 @@
 include $(top_srcdir)/aminclude.am
 
 AUTOMAKE_OPTIONS = serial-tests
-AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated
+if SOLARIS
+  SOLARIS_CPPFLAGS = -D_POSIX_PTHREAD_SEMANTICS
+  SOLARIS_LIB_LDFLAGS = -lnsl -lsocket
+endif
+AM_CPPFLAGS = -I${srcdir}/include -I${srcdir}/tests -I${srcdir}/generated $(SOLARIS_CPPFLAGS)
 AM_CFLAGS = -Wall -Werror -Wdeclaration-after-statement
 AM_CXXFLAGS = -Wall $(USEIPV6)
 
-LIB_LDFLAGS = -no-undefined -version-info 2
+LIB_LDFLAGS = -no-undefined -version-info 2 $(SOLARIS_LIB_LDFLAGS)
 
 pkginclude_HEADERS = include/zookeeper.h include/zookeeper_version.h include/zookeeper_log.h
include/proto.h include/recordio.h generated/zookeeper.jute.h
 EXTRA_DIST=LICENSE
@@ -98,23 +102,33 @@ TEST_SOURCES = \
 	tests/TestReadOnlyClient.cc \
 	$(NULL)
 
-SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests/wrappers.opt)
+if SOLARIS
+  SHELL_SYMBOL_WRAPPERS = cat ${srcdir}/tests/wrappers.opt
+  SYMBOL_WRAPPERS=$(SHELL_SYMBOL_WRAPPERS:sh)
+else
+  SYMBOL_WRAPPERS=$(shell cat ${srcdir}/tests/wrappers.opt)
+endif
 
 check_PROGRAMS = zktest-st
 TESTS_ENVIRONMENT = ZKROOT=${srcdir}/../.. \
                     CLASSPATH=$$CLASSPATH:$$CLOVER_HOME/lib/clover.jar
 nodist_zktest_st_SOURCES = $(TEST_SOURCES)
 zktest_st_LDADD = libzkst.la libhashtable.la $(CPPUNIT_LIBS)
-zktest_st_CXXFLAGS = -DUSE_STATIC_LIB $(CPPUNIT_CFLAGS) $(USEIPV6)
-zktest_st_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS)
+zktest_st_CXXFLAGS = -DUSE_STATIC_LIB $(CPPUNIT_CFLAGS) $(USEIPV6) $(SOLARIS_CPPFLAGS)
+zktest_st_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS) $(SOLARIS_LIB_LDFLAGS)
 
 if WANT_SYNCAPI
   check_PROGRAMS += zktest-mt
   nodist_zktest_mt_SOURCES = $(TEST_SOURCES) tests/PthreadMocks.cc
   zktest_mt_LDADD = libzkmt.la libhashtable.la -lpthread $(CPPUNIT_LIBS)
   zktest_mt_CXXFLAGS = -DUSE_STATIC_LIB -DTHREADED $(CPPUNIT_CFLAGS) $(USEIPV6)
+if SOLARIS
+  SHELL_SYMBOL_WRAPPERS_MT = cat ${srcdir}/tests/wrappers-mt.opt
+  SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(SHELL_SYMBOL_WRAPPERS_MT:sh)
+else
   SYMBOL_WRAPPERS_MT=$(SYMBOL_WRAPPERS) $(shell cat ${srcdir}/tests/wrappers-mt.opt)
-  zktest_mt_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS_MT)
+endif
+  zktest_mt_LDFLAGS = -static-libtool-libs $(SYMBOL_WRAPPERS_MT) $(SOLARIS_LIB_LDFLAGS)
 endif
 
 TESTS = $(check_PROGRAMS)

Modified: zookeeper/trunk/src/c/configure.ac
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/configure.ac?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/src/c/configure.ac (original)
+++ zookeeper/trunk/src/c/configure.ac Mon May 18 07:35:50 2015
@@ -154,4 +154,14 @@ LIBS="$saved_LIBS"
 AC_CHECK_FUNCS([getcwd gethostbyname gethostname getlogin getpwuid_r gettimeofday getuid
memmove memset poll socket strchr strdup strerror strtol])
 
 AC_CONFIG_FILES([Makefile])
+AC_CANONICAL_HOST
+AM_CONDITIONAL([SOLARIS],[
+  case "$host_os" in
+  *solaris*)
+    true
+    ;;
+  *)
+    false
+    ;;
+  esac ])
 AC_OUTPUT

Modified: zookeeper/trunk/src/c/src/zk_log.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zk_log.c?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zk_log.c (original)
+++ zookeeper/trunk/src/c/src/zk_log.c Mon May 18 07:35:50 2015
@@ -155,8 +155,9 @@ void log_message(log_callback_fn callbac
 
 #ifndef THREADED
 
+    // pid_t is long on Solaris
     ofs = snprintf(buf, FORMAT_LOG_BUF_SIZE,
-                   "%s:%d:%s@%s@%d: ", time, pid,
+                   "%s:%ld:%s@%s@%d: ", time, (long)pid,
                    dbgLevelStr[curLevel], funcName, line);
 #else
 
@@ -167,7 +168,7 @@ void log_message(log_callback_fn callbac
     #endif
 
     ofs = snprintf(buf, FORMAT_LOG_BUF_SIZE-1,
-                   "%s:%d(0x%lx):%s@%s@%d: ", time, pid, tid,
+                   "%s:%ld(0x%lx):%s@%s@%d: ", time, (long)pid, tid,
                    dbgLevelStr[curLevel], funcName, line);
 #endif
 

Modified: zookeeper/trunk/src/c/src/zookeeper.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zookeeper.c?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ zookeeper/trunk/src/c/src/zookeeper.c Mon May 18 07:35:50 2015
@@ -235,11 +235,16 @@ typedef int sendsize_t;
 #define SEND_FLAGS  0
 #else
 #ifdef __APPLE__
-#define MSG_NOSIGNAL SO_NOSIGPIPE
+#define SEND_FLAGS SO_NOSIGPIPE
+#endif
+#ifdef __linux__
+#define SEND_FLAGS MSG_NOSIGNAL
+#endif
+#ifndef SEND_FLAGS
+#define SEND_FLAGS 0
 #endif
 typedef int socket_t;
 typedef ssize_t sendsize_t;
-#define SEND_FLAGS  MSG_NOSIGNAL
 #endif
 
 static void zookeeper_set_sock_nodelay(zhandle_t *, socket_t);

Modified: zookeeper/trunk/src/c/tests/LibCMocks.cc
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/tests/LibCMocks.cc?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/src/c/tests/LibCMocks.cc (original)
+++ zookeeper/trunk/src/c/tests/LibCMocks.cc Mon May 18 07:35:50 2015
@@ -148,7 +148,7 @@ Mock_calloc* Mock_calloc::mock_=0;
 // realloc
 
 #ifndef USING_DUMA
-void* realloc(void* p, size_t s){
+DECLARE_WRAPPER(void*,realloc,(void* p, size_t s)){
     if(!Mock_realloc::mock_)
         return LIBC_SYMBOLS.realloc(p,s);
     return Mock_realloc::mock_->call(p,s);

Modified: zookeeper/trunk/src/c/tests/wrappers.opt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/tests/wrappers.opt?rev=1679951&r1=1679950&r2=1679951&view=diff
==============================================================================
--- zookeeper/trunk/src/c/tests/wrappers.opt (original)
+++ zookeeper/trunk/src/c/tests/wrappers.opt Mon May 18 07:35:50 2015
@@ -4,3 +4,4 @@
 -Wl,--wrap -Wl,get_xid
 -Wl,--wrap -Wl,deliverWatchers
 -Wl,--wrap -Wl,activateWatcher
+-Wl,--wrap -Wl,realloc



Mime
View raw message