Page MenuHomeClusterLabs Projects

No OneTemporary

diff --git a/Makefile.am b/Makefile.am
index 178b34da..b16eae6b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,184 +1,184 @@
# Copyright (c) 2009 Red Hat, Inc.
#
# Authors: Andrew Beekhof
# Steven Dake (sdake@redhat.com)
#
# This software licensed under BSD license, the text of which follows:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# - Neither the name of the MontaVista Software, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
SPEC = $(PACKAGE_NAME).spec
TARFILE = $(PACKAGE_NAME)-$(VERSION).tar.gz
EXTRA_DIST = autogen.sh $(SPEC).in \
build-aux/git-version-gen \
build-aux/gitlog-to-changelog \
build-aux/release.mk \
.version
AUTOMAKE_OPTIONS = foreign
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \
config.guess config.sub missing install-sh \
autoheader automake autoconf test_lense.sh
dist_doc_DATA = LICENSE INSTALL README.recovery SECURITY TODO AUTHORS
-SUBDIRS = include lib exec tools test cts pkgconfig \
+SUBDIRS = include common_lib lib exec tools test cts pkgconfig \
man init conf
coverity:
cov-build --dir=cov make
cov-analyze --dir cov --concurrency --wait-for-license
cov-format-errors --dir cov
install-exec-local:
$(INSTALL) -d $(DESTDIR)/${COROSYSCONFDIR}/service.d
$(INSTALL) -d $(DESTDIR)/${COROSYSCONFDIR}/uidgid.d
$(INSTALL) -d $(DESTDIR)/${localstatedir}/lib/corosync
$(INSTALL) -d $(DESTDIR)/${localstatedir}/log/cluster
$(INSTALL) -d $(DESTDIR)/${SOCKETDIR}
uninstall-local:
rmdir $(DESTDIR)/${COROSYSCONFDIR}/service.d || :;
rmdir $(DESTDIR)/${COROSYSCONFDIR}/uidgid.d || :;
rmdir $(DESTDIR)/${localstatedir}/lib/corosync || :;
rmdir $(DESTDIR)/${localstatedir}/log/cluster || :;
rmdir $(DESTDIR)/${SOCKETDIR} || :;
if AUGTOOL
check_SCRIPTS = test_lense.sh
TESTS = $(check_SCRIPTS)
test_lense.sh:
echo "augparse -I $(srcdir)/conf/lenses/ $(srcdir)/conf/lenses/tests/test_corosync.aug" > $@
chmod +x $@
endif
lint:
for dir in lib exec tools test; do make -C $$dir lint; done
.PHONY: doxygen
doxygen:
@if [ "$(DOXYGEN)" = "" ] || [ "$(DOT)" = "" ] ; then \
echo "*********************************************" ; \
echo "*** ***" ; \
echo "*** You must install doxygen and graphviz ***" ; \
echo "*** to generate the API documentation. ***" ; \
echo "*** ***" ; \
echo "*********************************************" ; \
exit 1 ; \
else \
mkdir -p doc/api && $(DOXYGEN) ; \
fi
dist-clean-local:
rm -f autoconf automake autoheader test_lense.sh
clean-generic:
rm -rf doc/api $(SPEC) $(TARFILE) test_lense.sh
## make rpm/srpm section.
$(SPEC): $(SPEC).in
rm -f $@-t $@
date="$(shell LC_ALL=C date "+%a %b %d %Y")" && \
if [ -f .tarball-version ]; then \
gitver="$(shell cat .tarball-version)" && \
rpmver=$$gitver && \
alphatag="" && \
dirty="" && \
numcomm="0"; \
else \
gitver="$(shell git describe --abbrev=4 --match='v*' HEAD 2>/dev/null)" && \
rpmver=`echo $$gitver | sed -e "s/^v//" -e "s/-.*//g"` && \
alphatag=`echo $$gitver | sed -e "s/.*-//" -e "s/^g//"` && \
vtag=`echo $$gitver | sed -e "s/-.*//g"` && \
numcomm=`git rev-list $$vtag..HEAD | wc -l` && \
git update-index --refresh > /dev/null 2>&1 || true && \
dirty=`git diff-index --name-only HEAD 2>/dev/null`; \
fi && \
if [ -n "$$dirty" ]; then dirty="dirty"; else dirty=""; fi && \
if [ "$$numcomm" = "0" ]; then \
sed \
-e "s#@version@#$$rpmver#g" \
-e "s#%glo.*alpha.*##g" \
-e "s#%glo.*numcomm.*##g" \
-e "s#@dirty@#$$dirty#g" \
-e "s#@date@#$$date#g" \
$< > $@-t; \
else \
sed \
-e "s#@version@#$$rpmver#g" \
-e "s#@alphatag@#$$alphatag#g" \
-e "s#@numcomm@#$$numcomm#g" \
-e "s#@dirty@#$$dirty#g" \
-e "s#@date@#$$date#g" \
$< > $@-t; \
fi; \
if [ -z "$$dirty" ]; then sed -i -e "s#%glo.*dirty.*##g" $@-t; fi
chmod a-w $@-t
mv $@-t $@
$(TARFILE):
$(MAKE) dist
RPMBUILDOPTS = --define "_sourcedir $(abs_builddir)" \
--define "_specdir $(abs_builddir)" \
--define "_builddir $(abs_builddir)" \
--define "_srcrpmdir $(abs_builddir)" \
--define "_rpmdir $(abs_builddir)"
srpm: clean
$(MAKE) $(SPEC) $(TARFILE)
rpmbuild $(RPMBUILDOPTS) --nodeps -bs $(SPEC)
rpm: clean _version
$(MAKE) $(SPEC) $(TARFILE)
rpmbuild $(RPMBUILDOPTS) -ba $(SPEC)
# release/versioning
BUILT_SOURCES = .version
.version:
echo $(VERSION) > $@-t && mv $@-t $@
dist-hook: gen-ChangeLog
echo $(VERSION) > $(distdir)/.tarball-version
gen_start_date = 2000-01-01
.PHONY: gen-ChangeLog _version
gen-ChangeLog:
if test -d .git; then \
LC_ALL=C $(top_srcdir)/build-aux/gitlog-to-changelog \
--since=$(gen_start_date) > $(distdir)/cl-t; \
rm -f $(distdir)/ChangeLog; \
mv $(distdir)/cl-t $(distdir)/ChangeLog; \
fi
_version:
cd $(srcdir) && rm -rf autom4te.cache .version && autoreconf -i
$(MAKE) $(AM_MAKEFLAGS) Makefile
diff --git a/common_lib/Makefile.am b/common_lib/Makefile.am
new file mode 100644
index 00000000..1732019c
--- /dev/null
+++ b/common_lib/Makefile.am
@@ -0,0 +1,43 @@
+#
+# Copyright (c) 2012 Red Hat, Inc.
+#
+# Authors: Angus Salkeld
+#
+# This software licensed under BSD license, the text of which follows:
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# - Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# - Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# - Neither the name of the MontaVista Software, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from this
+# software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGE.
+
+MAINTAINERCLEANFILES = Makefile.in
+
+AM_CFLAGS = -fPIC
+
+INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
+
+noinst_LIBRARIES = libcorosync_common.a
+
+libcorosync_common_a_SOURCES = error_conversion.c
+
+clean-local:
+ rm -f *.o *.a
diff --git a/common_lib/error_conversion.c b/common_lib/error_conversion.c
new file mode 100644
index 00000000..66a84e0c
--- /dev/null
+++ b/common_lib/error_conversion.c
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2008 Allied Telesis Labs.
+ * Copyright (c) 2012 Red Hat, Inc.
+ *
+ * All rights reserved.
+ *
+ * Author: Angus Salkeld (asalkeld@redhat.com)
+ *
+ * This software licensed under BSD license, the text of which follows:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * - Neither the name of the MontaVista Software, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <corosync/corotypes.h>
+
+cs_error_t qb_to_cs_error (int result)
+{
+ int32_t res;
+ cs_error_t err = CS_ERR_LIBRARY;
+
+ if (result >= 0) {
+ return CS_OK;
+ }
+ res = -result;
+
+ switch (res) {
+ case EBADF:
+ err = CS_ERR_BAD_HANDLE;
+ break;
+ case ENOMEM:
+ err = CS_ERR_NO_MEMORY;
+ break;
+ case ETIMEDOUT:
+ case EAGAIN:
+ err = CS_ERR_TRY_AGAIN;
+ break;
+ case EBADE:
+ err = CS_ERR_FAILED_OPERATION;
+ break;
+ case ETIME:
+ err = CS_ERR_TIMEOUT;
+ break;
+ case EINVAL:
+ err = CS_ERR_INVALID_PARAM;
+ break;
+ case EBUSY:
+ err = CS_ERR_BUSY;
+ break;
+ case EACCES:
+ err = CS_ERR_ACCESS;
+ break;
+ case EOVERFLOW:
+ err = CS_ERR_NAME_TOO_LONG;
+ break;
+ case EEXIST:
+ err = CS_ERR_EXIST;
+ break;
+ case ENOBUFS:
+ err = CS_ERR_QUEUE_FULL;
+ break;
+ case ENOSPC:
+ err = CS_ERR_NO_SPACE;
+ break;
+ case EINTR:
+ err = CS_ERR_INTERRUPT;
+ break;
+ case ENOENT:
+ case ENODEV:
+ err = CS_ERR_NOT_EXIST;
+ break;
+ case ENOSYS:
+ case ENOTSUP:
+ err = CS_ERR_NOT_SUPPORTED;
+ break;
+ case EBADMSG:
+ err = CS_ERR_MESSAGE_ERROR;
+ break;
+ case EMSGSIZE:
+ case E2BIG:
+ err = CS_ERR_TOO_BIG;
+ break;
+ case ECONNREFUSED:
+ case ENOTCONN:
+ default:
+ err = CS_ERR_LIBRARY;
+ break;
+ }
+
+ return err;
+}
+
+
diff --git a/configure.ac b/configure.ac
index d03c91ba..65abfae3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,669 +1,670 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# bootstrap / init
AC_PREREQ([2.61])
AC_INIT([corosync],
m4_esyscmd([build-aux/git-version-gen .tarball-version]),
[discuss@lists.corosync.org])
AM_INIT_AUTOMAKE([-Wno-portability])
AM_SILENT_RULES([yes])
AC_CONFIG_SRCDIR([lib/cpg.c])
AC_CONFIG_HEADER([include/corosync/config.h include/corosync/cs_config.h])
AC_CANONICAL_HOST
AC_LANG([C])
dnl Fix default variables - "prefix" variable if not specified
if test "$prefix" = "NONE"; then
prefix="/usr"
dnl Fix "localstatedir" variable if not specified
if test "$localstatedir" = "\${prefix}/var"; then
localstatedir="/var"
fi
dnl Fix "sysconfdir" variable if not specified
if test "$sysconfdir" = "\${prefix}/etc"; then
sysconfdir="/etc"
fi
dnl Fix "libdir" variable if not specified
if test "$libdir" = "\${exec_prefix}/lib"; then
if test -e /usr/lib64; then
libdir="/usr/lib64"
else
libdir="/usr/lib"
fi
fi
fi
if test "$srcdir" = "."; then
AC_MSG_NOTICE([building in place srcdir:$srcdir])
AC_DEFINE([BUILDING_IN_PLACE], 1, [building in place])
else
AC_MSG_NOTICE([building out of tree srcdir:$srcdir])
fi
# Checks for programs.
# check stolen from gnulib/m4/gnu-make.m4
if ! ${MAKE-make} --version /cannot/make/this >/dev/null 2>&1; then
AC_MSG_ERROR([you don't seem to have GNU make; it is required])
fi
sinclude(coroysync-default.m4)
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_CHECK_PROGS([GROFF], [groff])
AC_CHECK_PROGS([PKGCONFIG], [pkg-config])
AC_CHECK_PROGS([AUGTOOL], [augtool])
AC_CHECK_PROGS([DOT], [dot])
AC_CHECK_PROGS([DOXYGEN], [doxygen])
# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen])
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([nsl], [t_open])
AC_CHECK_LIB([rt], [sched_getscheduler])
PKG_CHECK_MODULES([LIBQB], [libqb])
AC_CHECK_LIB([qb], [qb_log_thread_priority_set], \
have_qb_log_thread_priority_set="yes", \
have_qb_log_thread_priority_set="no")
if test "x${have_qb_log_thread_priority_set}" = xyes; then
AC_DEFINE_UNQUOTED([HAVE_QB_LOG_THREAD_PRIORITY_SET], 1, [have qb_log_thread_priority_set])
fi
# Checks for header files.
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h \
stdlib.h string.h sys/ioctl.h sys/param.h sys/socket.h \
sys/time.h syslog.h unistd.h sys/types.h getopt.h malloc.h \
sys/sockio.h utmpx.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_C_VOLATILE
# Checks for library functions.
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_REPLACE_FNMATCH
AC_FUNC_FORK
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([alarm alphasort atexit bzero dup2 endgrent endpwent fcntl \
getcwd getpeerucred getpeereid gettimeofday inet_ntoa memmove \
memset mkdir scandir select socket strcasecmp strchr strdup \
strerror strrchr strspn strstr pthread_setschedparam \
sched_get_priority_max sched_setscheduler])
AC_CONFIG_FILES([Makefile
exec/Makefile
include/Makefile
init/Makefile
lib/Makefile
+ common_lib/Makefile
man/Makefile
pkgconfig/Makefile
test/Makefile
cts/Makefile
cts/agents/Makefile
cts/CTSvars.py
tools/Makefile
conf/Makefile
Doxyfile])
### Local business
dnl ===============================================
dnl Functions / global M4 variables
dnl ===============================================
dnl Global list of LIB names
m4_define([local_soname_list], [])dnl
dnl Upcase parameter
m4_define([local_upcase], [translit([$*], [a-z], [A-Z])])dnl
dnl M4 macro for include lib/lib$1.soname and subst that
m4_define([LIB_SONAME_IMPORT],[dnl
m4_define([local_libname], local_upcase($1)[_SONAME])dnl
m4_define([local_soname], translit(m4_sinclude(lib/lib$1.verso), [
], []))dnl
local_libname="local_soname"dnl
m4_define([local_soname_list], m4_defn([local_soname_list])[,]local_libname[,]local_upcase($1))dnl
AC_SUBST(local_libname)dnl
])dnl
dnl M4 macro for print padspaces (used in LIB_MSG_RESULT). It takes 2 arguments, length of string to pad and desired
dnl (padded) length
m4_define([m4_printpadspace],[ifelse(m4_eval([$2 - $1 < 1]),[1],,[ ][m4_printpadspace([$1],m4_eval([$2 - 1]))])])dnl
dnl Show AC_MSG_RESULT for specific libraries
m4_define([LIB_MSG_RESULT], [ifelse([$#], [1], ,[dnl
AC_MSG_RESULT([ $2 Library SONAME m4_printpadspace(len($2),8) = ${$1}])
LIB_MSG_RESULT(m4_shift(m4_shift($@)))dnl
])])dnl
# ===============================================
# Helpers
# ===============================================
## helper for CC stuff
cc_supports_flag() {
local CPPFLAGS="$CPPFLAGS $@"
AC_MSG_CHECKING([whether $CC supports "$@"])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([])],
[RC=0; AC_MSG_RESULT([yes])],
[RC=1; AC_MSG_RESULT([no])])
return $RC
}
## cleanup
AC_MSG_NOTICE(Sanitizing prefix: ${prefix})
case $prefix in
NONE) prefix=/usr/local;;
esac
AC_MSG_NOTICE(Sanitizing exec_prefix: ${exec_prefix})
case $exec_prefix in
dnl For consistency with Corosync, map NONE->$prefix
NONE) exec_prefix=$prefix;;
prefix) exec_prefix=$prefix;;
esac
## local defines
PACKAGE_FEATURES=""
LINT_FLAGS="-weak -unrecog +posixlib +ignoresigns -fcnuse \
-badflag -D__gnuc_va_list=va_list -D__attribute\(x\)="
# default libraries SONAME
SOMAJOR="4"
SOMINOR="0"
SOMICRO="0"
SONAME="${SOMAJOR}.${SOMINOR}.${SOMICRO}"
# specific libraries SONAME
LIB_SONAME_IMPORT([cfg])
LIB_SONAME_IMPORT([cpg])
LIB_SONAME_IMPORT([evs])
LIB_SONAME_IMPORT([pload])
LIB_SONAME_IMPORT([quorum])
LIB_SONAME_IMPORT([sam])
LIB_SONAME_IMPORT([votequorum])
LIB_SONAME_IMPORT([cmap])
# local options
AC_ARG_ENABLE([ansi],
[ --enable-ansi : force to build with ANSI standards. ],
[ default="no" ])
AC_ARG_ENABLE([fatal-warnings],
[ --enable-fatal-warnings : enable fatal warnings. ],
[ default="no" ])
AC_ARG_ENABLE([debug],
[ --enable-debug : enable debug build. ],
[ default="no" ])
AC_ARG_ENABLE([user-flags],
[ --enable-user-flags : rely on user environment. ],
[ default="no" ])
AC_ARG_ENABLE([coverage],
[ --enable-coverage : coverage analysis of the codebase. ],
[ default="no" ])
AC_ARG_ENABLE([small-memory-footprint],
[ --enable-small-memory-footprint : Use small message queues and small messages sizes. ],
[ default="no" ])
AC_ARG_ENABLE([nss],
[ --enable-nss : Network Security Services encryption. ],,
[ enable_nss="yes" ])
AC_ARG_ENABLE([dbus],
[ --enable-dbus : dbus events. ],,
[ enable_dbus="no" ])
AC_ARG_ENABLE([testagents],
[ --enable-testagents : Install Test Agents. ],,
[ default="no" ])
AC_ARG_ENABLE([rdma],
[ --enable-rdma : Infiniband RDMA transport support ],,
[ enable_rdma="no" ])
AM_CONDITIONAL(BUILD_RDMA, test x$enable_rdma = xyes)
AC_ARG_ENABLE([monitoring],
[ --enable-monitoring : resource monitoring ],,
[ default="no" ])
AM_CONDITIONAL(BUILD_MONITORING, test x$enable_monitoring = xyes)
AC_ARG_ENABLE([watchdog],
[ --enable-watchdog : Watchdog support ],,
[ default="no" ])
AM_CONDITIONAL(BUILD_WATCHDOG, test x$enable_watchdog = xyes)
AC_ARG_ENABLE([augeas],
[ --enable-augeas : Install the augeas lens for corosync.conf ],,
[ enable_augeas="no" ])
AM_CONDITIONAL(INSTALL_AUGEAS, test x$enable_augeas = xyes)
AC_ARG_ENABLE([systemd],
[ --enable-systemd : Install systemd service files],,
[ enable_systemd="no" ])
AM_CONDITIONAL(INSTALL_SYSTEMD, test x$enable_systemd = xyes)
AC_ARG_WITH([initddir],
[ --with-initddir=DIR : path to init script directory. ],
[ INITDDIR="$withval" ],
[ INITDDIR="$sysconfdir/init.d" ])
AC_ARG_WITH([socket-dir],
[ --with-socket-dir=DIR : corosync socket dir. ],
[ SOCKETDIR="$withval" ],
[ SOCKETDIR="$localstatedir/run" ])
AC_ARG_ENABLE([snmp],
[ --enable-snmp : SNMP protocol support ],
[ default="no" ])
AC_ARG_ENABLE([xmlconf],
[ --enable-xmlconf : XML configuration support ],,
[ enable_xmlconf="no" ])
AM_CONDITIONAL(INSTALL_XMLCONF, test x$enable_xmlconf = xyes)
# OS detection
# THIS SECTION MUST DIE!
CP=cp
OS_LDL="-ldl"
have_linux="no"
case "$host_os" in
*linux*)
AC_DEFINE_UNQUOTED([COROSYNC_LINUX], [1],
[Compiling for Linux platform])
OS_CFLAGS=""
OS_CPPFLAGS="-D_GNU_SOURCE"
OS_LDFLAGS=""
OS_DYFLAGS="-rdynamic"
DARWIN_OPTS=""
have_linux="yes"
;;
darwin*)
AC_DEFINE_UNQUOTED([COROSYNC_DARWIN], [1],
[Compiling for Darwin platform])
CP=rsync
OS_CFLAGS=""
OS_CPPFLAGS=""
OS_LDFLAGS=""
OS_DYFLAGS=""
DARWIN_OPTS="-dynamiclib -bind_at_load \
-current_version ${SONAME} \
-compatibility_version ${SONAME} -install_name \$(libdir)/\$(@)"
AC_DEFINE_UNQUOTED([MAP_ANONYMOUS], [MAP_ANON],
[Shared memory define for Darwin platform])
AC_DEFINE_UNQUOTED([PATH_MAX], [4096],
[Number of chars in a path name including nul])
AC_DEFINE_UNQUOTED([NAME_MAX], [255],
[Number of chars in a file name])
;;
*bsd*)
AC_DEFINE_UNQUOTED([COROSYNC_BSD], [1],
[Compiling for BSD platform])
AC_DEFINE_UNQUOTED([MAP_ANONYMOUS], [MAP_ANON],
[Shared memory define for Darwin platform])
OS_CFLAGS=""
OS_CPPFLAGS="-I/usr/local/include"
OS_LDFLAGS="-L/usr/local/lib"
OS_DYFLAGS="-export-dynamic"
DARWIN_OPTS=""
OS_LDL=""
case "$host_os" in
*freebsd[[234567]]*)
;;
*freebsd*)
AC_DEFINE_UNQUOTED([COROSYNC_FREEBSD_GE_8], [1],
[Compiling for FreeBSD >= 8 platform])
;;
esac
;;
*solaris*)
AC_DEFINE_UNQUOTED([COROSYNC_SOLARIS], [1],
[Compiling for Solaris platform])
AC_DEFINE_UNQUOTED([TS_CLASS], [1],
[Prevent being scheduled RR])
AC_DEFINE_UNQUOTED([_SEM_SEMUN_UNDEFINED], [1],
[The semun structure is undefined])
CP=rsync
OS_CFLAGS=""
OS_CPPFLAGS="-D_REENTRANT"
OS_LDFLAGS=""
OS_DYFLAGS="-Wl,-z,lazyload"
DARWIN_OPTS=""
SOLARIS_OPTS=" "
;;
*)
AC_MSG_ERROR([Unsupported OS? hmmmm])
;;
esac
AC_SUBST(CP)
# *FLAGS handling goes here
ENV_CFLAGS="$CFLAGS"
ENV_CPPFLAGS="$CPPFLAGS"
ENV_LDFLAGS="$LDFLAGS"
# debug build stuff
if test "x${enable_debug}" = xyes; then
AC_DEFINE_UNQUOTED([DEBUG], [1], [Compiling Debugging code])
OPT_CFLAGS="-O0"
PACKAGE_FEATURES="$PACKAGE_FEATURES debug"
else
OPT_CFLAGS="-O3"
fi
# gdb flags
if test "x${GCC}" = xyes; then
GDB_FLAGS="-ggdb3"
else
GDB_FLAGS="-g"
fi
# Look for libnss
if test "x${enable_nss}" = xyes; then
PKG_CHECK_MODULES([nss],[nss])
AC_DEFINE_UNQUOTED([HAVE_LIBNSS], 1, [have libnss])
PACKAGE_FEATURES="$PACKAGE_FEATURES nss"
fi
# Look for dbus-1
if test "x${enable_dbus}" = xyes; then
PKG_CHECK_MODULES([DBUS],[dbus-1])
AC_DEFINE_UNQUOTED([HAVE_DBUS], 1, [have dbus])
PACKAGE_FEATURES="$PACKAGE_FEATURES dbus"
fi
if test "x${enable_testagents}" = xyes; then
AC_DEFINE_UNQUOTED([HAVE_TESTAGENTS], 1, [have testagents])
PACKAGE_FEATURES="$PACKAGE_FEATURES testagents"
fi
if test "x${enable_rdma}" = xyes; then
PKG_CHECK_MODULES([rdmacm],[rdmacm])
PKG_CHECK_MODULES([ibverbs],[ibverbs])
AC_DEFINE_UNQUOTED([HAVE_RDMA], 1, [have rdmacm])
PACKAGE_FEATURES="$PACKAGE_FEATURES rdma"
fi
if test "x${enable_monitoring}" = xyes; then
AC_CHECK_LIB([statgrab], [sg_get_mem_stats], have_libstatgrab="yes", have_libstatgrab="no")
if test "x${have_libstatgrab}" = xyes; then
AC_DEFINE_UNQUOTED([HAVE_LIBSTATGRAB], 1, [have libstatgrab])
statgrab_LIBS="-lstatgrab"
else
if test "x${have_linux}" = xno; then
AC_MSG_ERROR(monitoring requires libstatgrab on non-linux systems)
fi
fi
AC_SUBST([statgrab_LIBS])
AC_DEFINE_UNQUOTED([HAVE_MONITORING], 1, [have resource monitoring])
PACKAGE_FEATURES="$PACKAGE_FEATURES monitoring"
fi
if test "x${enable_watchdog}" = xyes; then
AC_CHECK_HEADER(linux/watchdog.h,,AC_MSG_ERROR(watchdog requires linux/watchdog.h))
AC_CHECK_HEADER(linux/reboot.h,,AC_MSG_ERROR(watchdog requires linux/reboot.h))
AC_DEFINE_UNQUOTED([HAVE_WATCHDOG], 1, [have watchdog])
PACKAGE_FEATURES="$PACKAGE_FEATURES watchdog"
fi
if test "x${enable_augeas}" = xyes; then
PACKAGE_FEATURES="$PACKAGE_FEATURES augeas"
fi
if test "x${enable_systemd}" = xyes; then
PACKAGE_FEATURES="$PACKAGE_FEATURES systemd"
fi
if test "x${enable_xmlconf}" = xyes; then
PACKAGE_FEATURES="$PACKAGE_FEATURES xmlconf"
fi
if test "x${enable_snmp}" = xyes; then
SNMPCONFIG=""
AC_CHECK_HEADERS(net-snmp/net-snmp-config.h)
if test "x${ac_cv_header_net_snmp_net_snmp_config_h}" != "xyes"; then
enable_snmp=no
fi
if test $enable_snmp != no; then
AC_PATH_PROGS(SNMPCONFIG, net-snmp-config)
if test "X${SNMPCONFIG}" = "X"; then
AC_MSG_RESULT(You need the net_snmp development package to continue.)
enable_snmp=no
fi
fi
if test $enable_snmp != no; then
AC_MSG_CHECKING(for special snmp libraries)
SNMPLIBS=`$SNMPCONFIG --libs`
AC_MSG_RESULT($SNMPLIBS)
fi
if test $enable_snmp != no; then
savedLibs=$LIBS
LIBS="$LIBS $SNMPLIBS"
AC_CHECK_FUNCS(netsnmp_transport_open_client)
if test $ac_cv_func_netsnmp_transport_open_client != yes; then
AC_CHECK_FUNCS(netsnmp_tdomain_transport)
if test $ac_cv_func_netsnmp_tdomain_transport != yes; then
enable_snmp=no
fi
else
AC_DEFINE_UNQUOTED([NETSNMPV54], $NETSNMP_NEW_SUPPORT, [have net-snmp5.4 over])
fi
LIBS=$savedLibs
fi
AC_MSG_CHECKING(for snmp)
AC_MSG_RESULT($enable_snmp)
if test $enable_snmp = no; then
enable_snmp=0
AC_MSG_ERROR(Unable to support SNMP)
else
enable_snmp=1
PACKAGE_FEATURES="$PACKAGE_FEATURES snmp"
AC_DEFINE_UNQUOTED([ENABLE_SNMP], $enable_snmp, [Build in support for sending SNMP traps])
fi
else
enable_snmp=0
fi
AC_SUBST([SNMPLIBS])
AM_CONDITIONAL(BUILD_SNMP, test "${enable_snmp}" = "1")
# extra warnings
EXTRA_WARNINGS=""
WARNLIST="
all
shadow
missing-prototypes
missing-declarations
strict-prototypes
declaration-after-statement
pointer-arith
write-strings
cast-align
bad-function-cast
missing-format-attribute
format=2
format-security
format-nonliteral
no-long-long
unsigned-char
gnu89-inline
no-strict-aliasing
"
for j in $WARNLIST; do
if cc_supports_flag -W$j; then
EXTRA_WARNINGS="$EXTRA_WARNINGS -W$j";
fi
done
if test "x${enable_coverage}" = xyes && \
cc_supports_flag -ftest-coverage && \
cc_supports_flag -fprofile-arcs ; then
AC_MSG_NOTICE([Enabling Coverage (enable -O0 by default)])
OPT_CFLAGS="-O0"
COVERAGE_CFLAGS="-ftest-coverage -fprofile-arcs"
COVERAGE_LDFLAGS="-ftest-coverage -fprofile-arcs"
PACKAGE_FEATURES="$PACKAGE_FEATURES coverage"
else
COVERAGE_CFLAGS=""
COVERAGE_LDFLAGS=""
fi
if test "x${enable_small_memory_footprint}" = xyes ; then
AC_DEFINE_UNQUOTED([HAVE_SMALL_MEMORY_FOOTPRINT], 1, [have small_memory_footprint])
PACKAGE_FEATURES="$PACKAGE_FEATURES small-memory-footprint"
fi
if test "x${enable_ansi}" = xyes && \
cc_supports_flag -std=iso9899:199409 ; then
AC_MSG_NOTICE([Enabling ANSI Compatibility])
ANSI_CPPFLAGS="-ansi -D_GNU_SOURCE -DANSI_ONLY"
PACKAGE_FEATURES="$PACKAGE_FEATURES ansi"
else
ANSI_CPPFLAGS=""
fi
if test "x${enable_fatal_warnings}" = xyes && \
cc_supports_flag -Werror ; then
AC_MSG_NOTICE([Enabling Fatal Warnings (-Werror)])
WERROR_CFLAGS="-Werror"
PACKAGE_FEATURES="$PACKAGE_FEATURES fatal-warnings"
else
WERROR_CFLAGS=""
fi
# don't add addtional cflags
if test "x${enable_user_flags}" = xyes; then
OPT_CFLAGS=""
GDB_FLAGS=""
EXTRA_WARNINGS=""
fi
# final build of *FLAGS
CFLAGS="$ENV_CFLAGS $OPT_CFLAGS $GDB_FLAGS $OS_CFLAGS \
$COVERAGE_CFLAGS $EXTRA_WARNINGS $WERROR_CFLAGS $NSS_CFLAGS"
CPPFLAGS="$ENV_CPPFLAGS $ANSI_CPPFLAGS $OS_CPPFLAGS"
LDFLAGS="$ENV_LDFLAGS $COVERAGE_LDFLAGS $OS_LDFLAGS"
# substitute what we need:
AC_SUBST([INITDDIR])
AC_SUBST([SOCKETDIR])
AC_SUBST([SOMAJOR])
AC_SUBST([SOMINOR])
AC_SUBST([SOMICRO])
AC_SUBST([SONAME])
AC_SUBST([OS_DYFLAGS])
AC_SUBST([OS_LDL])
AM_CONDITIONAL(INSTALL_TESTAGENTS, test -n "${enable_testagents}")
AM_CONDITIONAL(INSTALL_MIB, test "${enable_snmp}" = "1")
AM_CONDITIONAL(INSTALL_DBUSCONF, test "${enable_dbus}" = "1")
AM_CONDITIONAL(AUGTOOL, test -n "${AUGTOOL}")
AC_SUBST([NSS_LDFLAGS])
AM_CONDITIONAL(BUILD_DARWIN, test -n "${DARWIN_OPTS}")
AM_CONDITIONAL(BUILD_SOLARIS, test -n "${SOLARIS_OPTS}")
AC_SUBST([DARWIN_OPTS])
AC_SUBST([SOLARIS_OPTS])
AM_CONDITIONAL(BUILD_HTML_DOCS, test -n "${GROFF}")
AC_SUBST([LINT_FLAGS])
AC_DEFINE_UNQUOTED([SOCKETDIR], "$(eval echo ${SOCKETDIR})", [Socket directory])
AC_DEFINE_UNQUOTED([LOCALSTATEDIR], "$(eval echo ${localstatedir})", [localstate directory])
COROSYSCONFDIR=${sysconfdir}/corosync
AC_SUBST([COROSYSCONFDIR])
AC_DEFINE_UNQUOTED([COROSYSCONFDIR], "$(eval echo ${COROSYSCONFDIR})", [corosync config directory])
AC_DEFINE_UNQUOTED([PACKAGE_FEATURES], "${PACKAGE_FEATURES}", [corosync built-in features])
AC_OUTPUT
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE configuration:])
AC_MSG_RESULT([ Version = ${VERSION}])
AC_MSG_RESULT([ Prefix = ${prefix}])
AC_MSG_RESULT([ Executables = ${sbindir}])
AC_MSG_RESULT([ Man pages = ${mandir}])
AC_MSG_RESULT([ Doc dir = ${docdir}])
AC_MSG_RESULT([ Libraries = ${libdir}])
AC_MSG_RESULT([ Header files = ${includedir}])
AC_MSG_RESULT([ Arch-independent files = ${datadir}])
AC_MSG_RESULT([ State information = ${localstatedir}])
AC_MSG_RESULT([ System configuration = ${sysconfdir}])
AC_MSG_RESULT([ System init.d directory = ${INITDDIR}])
AC_MSG_RESULT([ corosync config dir = ${COROSYSCONFDIR}])
AC_MSG_RESULT([ SOCKETDIR = ${SOCKETDIR}])
AC_MSG_RESULT([ Features =${PACKAGE_FEATURES}])
AC_MSG_RESULT([])
AC_MSG_RESULT([$PACKAGE build info:])
AC_MSG_RESULT([ Library SONAME = ${SONAME}])
LIB_MSG_RESULT(m4_shift(local_soname_list))dnl
AC_MSG_RESULT([ Default optimization = ${OPT_CFLAGS}])
AC_MSG_RESULT([ Default debug options = ${GDB_CFLAGS}])
AC_MSG_RESULT([ Extra compiler warnings = ${EXTRA_WARNING}])
AC_MSG_RESULT([ Env. defined CFLAG = ${ENV_CFLAGS}])
AC_MSG_RESULT([ Env. defined CPPFLAGS = ${ENV_CPPFLAGS}])
AC_MSG_RESULT([ Env. defined LDFLAGS = ${ENV_LDFLAGS}])
AC_MSG_RESULT([ OS defined CFLAGS = ${OS_CFLAGS}])
AC_MSG_RESULT([ OS defined CPPFLAGS = ${OS_CPPFLAGS}])
AC_MSG_RESULT([ OS defined LDFLAGS = ${OS_LDFLAGS}])
AC_MSG_RESULT([ OS defined LDL = ${OS_LDL}])
AC_MSG_RESULT([ OS defined DYFLAGS = ${OS_DYFLAGS}])
AC_MSG_RESULT([ ANSI defined CPPFLAGS = ${ANSI_CPPFLAGS}])
AC_MSG_RESULT([ Coverage CFLAGS = ${COVERAGE_CFLAGS}])
AC_MSG_RESULT([ Coverage LDFLAGS = ${COVERAGE_LDFLAGS}])
AC_MSG_RESULT([ Fatal War. CFLAGS = ${WERROR_CFLAGS}])
AC_MSG_RESULT([ Final CFLAGS = ${CFLAGS}])
AC_MSG_RESULT([ Final CPPFLAGS = ${CPPFLAGS}])
AC_MSG_RESULT([ Final LDFLAGS = ${LDFLAGS}])
diff --git a/exec/Makefile.am b/exec/Makefile.am
index 3b6f2014..d4d83ebd 100644
--- a/exec/Makefile.am
+++ b/exec/Makefile.am
@@ -1,116 +1,116 @@
# Copyright (c) 2009 Red Hat, Inc.
#
# Authors: Andrew Beekhof
# Steven Dake (sdake@redhat.com)
#
# This software licensed under BSD license, the text of which follows:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# - Neither the name of the MontaVista Software, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
MAINTAINERCLEANFILES = Makefile.in
AM_CFLAGS = -fPIC
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include $(nss_CFLAGS) $(rdmacm_CFLAGS) $(ibverbs_CFLAGS)
TOTEM_SRC = totemip.c totemnet.c totemudp.c \
totemudpu.c totemrrp.c totemsrp.c totemmrp.c \
totempg.c crypto.c cs_queue.h
if BUILD_RDMA
TOTEM_SRC += totemiba.c
endif
lib_LIBRARIES = libtotem_pg.a
sbin_PROGRAMS = corosync
libtotem_pg_a_SOURCES = $(TOTEM_SRC)
corosync_SOURCES = evil.c vsf_ykd.c coroparse.c vsf_quorum.c syncv2.c \
logsys.c cfg.c cmap.c cpg.c evs.c mon.c pload.c \
votequorum.c wd.c util.c schedwrk.c main.c \
apidef.c quorum.c sync.c icmap.c timer.c \
ipc_glue.c service.c mainconfig.c totemconfig.c
-corosync_LDADD = -ltotem_pg $(LIBQB_LIBS) $(statgrab_LIBS)
-corosync_DEPENDENCIES = libtotem_pg.so.$(SONAME)
+corosync_LDADD = -ltotem_pg ../common_lib/libcorosync_common.a $(LIBQB_LIBS) $(statgrab_LIBS)
+corosync_DEPENDENCIES = libtotem_pg.so.$(SONAME) ../common_lib/libcorosync_common.a
corosync_LDFLAGS = $(OS_DYFLAGS) -L./
TOTEM_OBJS = $(TOTEM_SRC:%.c=%.o)
LOGSYS_OBJS = $(LOGSYS_SRC:%.c=%.o)
SHARED_LIBS = $(lib_LIBRARIES:%.a=%.so.$(SONAME))
SHARED_LIBS_SO = $(SHARED_LIBS:%.so.$(SONAME)=%.so)
SHARED_LIBS_SO_TWO = $(SHARED_LIBS:%.so.$(SONAME)=%.so.$(SOMAJOR))
noinst_HEADERS = apidef.h crypto.h mainconfig.h main.h \
quorum.h service.h sync.h timer.h totemconfig.h \
totemmrp.h totemnet.h totemudp.h totemiba.h totemrrp.h \
totemudpu.h totemsrp.h util.h vsf.h schedwrk.h \
evil.h syncv2.h fsm.h votequorum.h vsf_ykd.h
if BUILD_DARWIN
libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
$(CC) $(LDFLAGS) $(DARWIN_OPTS) $(TOTEM_OBJS) -o $@ -lpthread
ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
else
if BUILD_SOLARIS
libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
$(LD) $(LDFLAGS) -G $(TOTEM_OBJS) -o $@ -lpthread
ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
else
libtotem_pg.so.$(SONAME): $(TOTEM_OBJS)
$(CC) -shared -o $@ \
-Wl,-soname=libtotem_pg.so.$(SOMAJOR) \
$(LDFLAGS) $^ $(nss_LIBS) $(rdmacm_LIBS) $(ibverbs_LIBS) -lpthread
ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so
ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR)
endif
endif
lint:
-splint $(INCLUDES) $(LINT_FLAGS) $(CFLAGS) *.c
all-local: $(LCRSO_OBJS) $(LCRSO) $(SHARED_LIBS)
@echo Built corosync Executive
install-exec-local:
$(INSTALL) -d $(DESTDIR)/$(libdir)
$(INSTALL) -m 755 $(SHARED_LIBS) $(DESTDIR)/$(libdir)
$(CP) -a $(SHARED_LIBS_SO) $(SHARED_LIBS_SO_TWO) $(DESTDIR)/$(libdir)
uninstall-local:
cd $(DESTDIR)/$(libdir) && \
rm -f $(SHARED_LIBS) $(SHARED_LIBS_SO) $(SHARED_LIBS_SO_TWO)
cd $(DESTDIR)/$(LCRSODIR) && \
rm -f $(LCRSO)
clean-local:
rm -f corosync *.o gmon.out *.da *.bb *.bbg *.so*
diff --git a/include/corosync/corotypes.h b/include/corosync/corotypes.h
index 906b4c78..56ffa140 100644
--- a/include/corosync/corotypes.h
+++ b/include/corosync/corotypes.h
@@ -1,315 +1,241 @@
/*
* Copyright (c) 2008 Allied Telesis Labs.
*
* All rights reserved.
*
* Author: Angus Salkeld (ahsalkeld@gmail.com)
*
* This software licensed under BSD license, the text of which follows:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the MontaVista Software, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef COROTYPES_H_DEFINED
#define COROTYPES_H_DEFINED
#ifndef COROSYNC_SOLARIS
#include <stdint.h>
#else
#include <sys/types.h>
#endif
#include <errno.h>
#include <time.h>
#include <sys/time.h>
typedef int64_t cs_time_t;
#define CS_FALSE 0
#define CS_TRUE !CS_FALSE
#define CS_MAX_NAME_LENGTH 256
#define CS_TIME_END ((cs_time_t)0x7FFFFFFFFFFFFFFFULL)
#define CS_MAX(x, y) (((x) > (y)) ? (x) : (y))
typedef struct {
uint16_t length;
uint8_t value[CS_MAX_NAME_LENGTH];
} cs_name_t;
typedef struct {
char releaseCode;
unsigned char majorVersion;
unsigned char minorVersion;
} cs_version_t;
typedef enum {
CS_DISPATCH_ONE = 1,
CS_DISPATCH_ALL = 2,
CS_DISPATCH_BLOCKING = 3,
CS_DISPATCH_ONE_NONBLOCKING = 4
} cs_dispatch_flags_t;
#define CS_TRACK_CURRENT 0x01
#define CS_TRACK_CHANGES 0x02
#define CS_TRACK_CHANGES_ONLY 0x04
typedef enum {
CS_OK = 1,
CS_ERR_LIBRARY = 2,
CS_ERR_VERSION = 3,
CS_ERR_INIT = 4,
CS_ERR_TIMEOUT = 5,
CS_ERR_TRY_AGAIN = 6,
CS_ERR_INVALID_PARAM = 7,
CS_ERR_NO_MEMORY = 8,
CS_ERR_BAD_HANDLE = 9,
CS_ERR_BUSY = 10,
CS_ERR_ACCESS = 11,
CS_ERR_NOT_EXIST = 12,
CS_ERR_NAME_TOO_LONG = 13,
CS_ERR_EXIST = 14,
CS_ERR_NO_SPACE = 15,
CS_ERR_INTERRUPT = 16,
CS_ERR_NAME_NOT_FOUND = 17,
CS_ERR_NO_RESOURCES = 18,
CS_ERR_NOT_SUPPORTED = 19,
CS_ERR_BAD_OPERATION = 20,
CS_ERR_FAILED_OPERATION = 21,
CS_ERR_MESSAGE_ERROR = 22,
CS_ERR_QUEUE_FULL = 23,
CS_ERR_QUEUE_NOT_AVAILABLE = 24,
CS_ERR_BAD_FLAGS = 25,
CS_ERR_TOO_BIG = 26,
CS_ERR_NO_SECTIONS = 27,
CS_ERR_CONTEXT_NOT_FOUND = 28,
CS_ERR_TOO_MANY_GROUPS = 30,
CS_ERR_SECURITY = 100
} cs_error_t;
#define CS_IPC_TIMEOUT_MS 1000
#define CS_TIME_MS_IN_SEC 1000ULL
#define CS_TIME_US_IN_SEC 1000000ULL
#define CS_TIME_NS_IN_SEC 1000000000ULL
#define CS_TIME_US_IN_MSEC 1000ULL
#define CS_TIME_NS_IN_MSEC 1000000ULL
#define CS_TIME_NS_IN_USEC 1000ULL
static inline uint64_t cs_timestamp_get(void)
{
uint64_t result;
#if defined _POSIX_MONOTONIC_CLOCK && _POSIX_MONOTONIC_CLOCK >= 0
struct timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
result = (ts.tv_sec * CS_TIME_NS_IN_SEC) + (uint64_t)ts.tv_nsec;
#else
struct timeval time_from_epoch;
gettimeofday (&time_from_epoch, 0);
result = ((time_from_epoch.tv_sec * CS_TIME_NS_IN_SEC) +
(time_from_epoch.tv_usec * CS_TIME_NS_IN_USEC));
#endif
return result;
}
-static inline cs_error_t qb_to_cs_error (int result)
-{
- int32_t res;
- cs_error_t err = CS_ERR_LIBRARY;
-
- if (result >= 0) {
- return CS_OK;
- }
- res = -result;
-
- switch (res) {
- case EBADF:
- err = CS_ERR_BAD_HANDLE;
- break;
- case ENOMEM:
- err = CS_ERR_NO_MEMORY;
- break;
- case ETIMEDOUT:
- case EAGAIN:
- err = CS_ERR_TRY_AGAIN;
- break;
- case EBADE:
- err = CS_ERR_FAILED_OPERATION;
- break;
- case ETIME:
- err = CS_ERR_TIMEOUT;
- break;
- case EINVAL:
- err = CS_ERR_INVALID_PARAM;
- break;
- case EBUSY:
- err = CS_ERR_BUSY;
- break;
- case EACCES:
- err = CS_ERR_ACCESS;
- break;
- case EOVERFLOW:
- err = CS_ERR_NAME_TOO_LONG;
- break;
- case EEXIST:
- err = CS_ERR_EXIST;
- break;
- case ENOBUFS:
- err = CS_ERR_QUEUE_FULL;
- break;
- case ENOSPC:
- err = CS_ERR_NO_SPACE;
- break;
- case EINTR:
- err = CS_ERR_INTERRUPT;
- break;
- case ENOENT:
- case ENODEV:
- err = CS_ERR_NOT_EXIST;
- break;
- case ENOSYS:
- case ENOTSUP:
- err = CS_ERR_NOT_SUPPORTED;
- break;
- case EBADMSG:
- err = CS_ERR_MESSAGE_ERROR;
- break;
- case EMSGSIZE:
- case E2BIG:
- err = CS_ERR_TOO_BIG;
- break;
- case ECONNREFUSED:
- case ENOTCONN:
- default:
- err = CS_ERR_LIBRARY;
- break;
- }
-
- return err;
-}
+cs_error_t qb_to_cs_error (int result);
/*
* static inline so multiple libraries can link into same binary
*/
static inline const char * cs_strerror(cs_error_t err)
{
switch (err) {
case CS_OK:
return "success";
case CS_ERR_LIBRARY:
return "CS_ERR_LIBRARY";
case CS_ERR_VERSION:
return "CS_ERR_VERSION";
case CS_ERR_INIT:
return "CS_ERR_INIT";
case CS_ERR_NO_MEMORY:
return "CS_ERR_NO_MEMORY";
case CS_ERR_NAME_TOO_LONG :
return "CS_ERR_NAME_TOO_LONG ";
case CS_ERR_TIMEOUT:
return "CS_ERR_TIMEOUT";
case CS_ERR_TRY_AGAIN:
return "CS_ERR_TRY_AGAIN";
case CS_ERR_INVALID_PARAM:
return "CS_ERR_INVALID_PARAM";
case CS_ERR_BAD_HANDLE:
return "CS_ERR_BAD_HANDLE";
case CS_ERR_BUSY :
return "CS_ERR_BUSY ";
case CS_ERR_ACCESS :
return "CS_ERR_ACCESS ";
case CS_ERR_NOT_EXIST :
return "CS_ERR_NOT_EXIST ";
case CS_ERR_EXIST :
return "CS_ERR_EXIST ";
case CS_ERR_NO_SPACE :
return "CS_ERR_NO_SPACE ";
case CS_ERR_INTERRUPT :
return "CS_ERR_INTERRUPT ";
case CS_ERR_NAME_NOT_FOUND :
return "CS_ERR_NAME_NOT_FOUND ";
case CS_ERR_NO_RESOURCES :
return "CS_ERR_NO_RESOURCES ";
case CS_ERR_NOT_SUPPORTED :
return "CS_ERR_NOT_SUPPORTED ";
case CS_ERR_BAD_OPERATION :
return "CS_ERR_BAD_OPERATION ";
case CS_ERR_FAILED_OPERATION :
return "CS_ERR_FAILED_OPERATION ";
case CS_ERR_MESSAGE_ERROR :
return "CS_ERR_MESSAGE_ERROR ";
case CS_ERR_QUEUE_FULL :
return "CS_ERR_QUEUE_FULL ";
case CS_ERR_QUEUE_NOT_AVAILABLE :
return "CS_ERR_QUEUE_NOT_AVAILABLE ";
case CS_ERR_BAD_FLAGS :
return "CS_ERR_BAD_FLAGS ";
case CS_ERR_TOO_BIG :
return "CS_ERR_TOO_BIG ";
case CS_ERR_NO_SECTIONS :
return "CS_ERR_NO_SECTIONS ";
case CS_ERR_CONTEXT_NOT_FOUND :
return "CS_ERR_CONTEXT_NOT_FOUND ";
case CS_ERR_TOO_MANY_GROUPS :
return "CS_ERR_TOO_MANY_GROUPS ";
case CS_ERR_SECURITY :
return "CS_ERR_SECURITY ";
default:
return "unknown error";
}
}
#endif /* COROTYPES_H_DEFINED */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index d2dd8ed9..67442332 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,113 +1,113 @@
#
# Copyright (c) 2009 Red Hat, Inc.
#
# Authors: Andrew Beekhof
# Steven Dake (sdake@redhat.com)
#
# This software licensed under BSD license, the text of which follows:
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# - Neither the name of the MontaVista Software, Inc. nor the names of its
# contributors may be used to endorse or promote products derived from this
# software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
# Functions
uc=$(shell echo $1 | tr a-z A-Z)
get_soname=$(if $($(call uc,$1)_SONAME),$($(call uc,$1)_SONAME),$(SONAME))
get_major=$(firstword $(subst ., ,$(call get_soname,$1)))
get_sharedlibs=$(foreach lib,$(SHARED_LIBS_SO:lib%.so=%),lib$(lib).so.$(call get_soname,$(lib)))
get_sharedlibs_two=$(foreach lib,$(SHARED_LIBS_SO:lib%.so=%),lib$(lib).so.$(call get_major,$(lib)))
get_linker_add=$(if $($(call uc,$1)_LINKER_ADD),$($(call uc,$1)_LINKER_ADD))
MAINTAINERCLEANFILES = Makefile.in
AM_CFLAGS = -fPIC
AM_LDFLAGS = -lpthread
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include
lib_LIBRARIES = libcpg.a libquorum.a libevs.a libcfg.a \
libvotequorum.a libpload.a libsam.a libcmap.a
SHARED_LIBS_SO = $(lib_LIBRARIES:%.a=%.so)
libcpg_a_SOURCES = cpg.c
libcfg_a_SOURCES = cfg.c
libevs_a_SOURCES = evs.c
libpload_a_SOURCES = pload.c
libquorum_a_SOURCES = quorum.c
libvotequorum_a_SOURCES = votequorum.c
libcmap_a_SOURCES = cmap.c
SAM_LINKER_ADD = -L. -lquorum -lcmap
libsam_a_SOURCES = sam.c
noinst_HEADERS = util.h \
libcfg.versions \
libcpg.versions \
libevs.versions libpload.versions \
libquorum.versions libvotequorum.versions \
libsam.versions libcmap.versions
if BUILD_DARWIN
lib%.so: lib%.a $(LIBQB_LIBS)
$(CC) $(DARWIN_OPTS) $(call get_linker_add,$*) -Wl,-whole-archive $^ -Wl,-no-whole-archive -o $@
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
else
if BUILD_SOLARIS
lib%.so.$(SONAME): lib%.a
$(LD) $(SOLARIS_OPTS) $(call get_linker_add,$*) -G -whole-archive $^ -no-whole-archive -o $@
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
else
lib%.so: lib%.a
$(CC) -shared -o $@.$(call get_soname,$*) \
-Wl,-soname=lib$*.so.$(call get_major,$*) \
-Wl,-version-script=$(srcdir)/lib$*.versions \
- -Wl,-whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS) $(LIBQB_LIBS) $(AM_LDFLAGS) $(call get_linker_add,$*)
+ -Wl,-whole-archive $^ -Wl,-no-whole-archive $(LDFLAGS) $(LIBQB_LIBS) ../common_lib/libcorosync_common.a $(AM_LDFLAGS) $(call get_linker_add,$*)
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so
ln -sf lib$*.so.$(call get_soname,$*) lib$*.so.$(call get_major,$*)
endif
endif
all-local: $(get_explicit_sharedlibs) $(SHARED_LIBS_SO)
@echo Built shared libs
install-exec-local:
$(INSTALL) -d $(DESTDIR)/$(libdir)
$(INSTALL) -m 755 $(get_sharedlibs) $(DESTDIR)/$(libdir)
$(CP) -a $(SHARED_LIBS_SO) $(get_sharedlibs_two) $(DESTDIR)/$(libdir)
uninstall-local:
cd $(DESTDIR)/$(libdir)/ && \
rm -f $(get_sharedlibs) $(SHARED_LIBS_SO) $(get_sharedlibs_two)
clean-local:
rm -f *.o *.a *.so* *.da *.bb *.bbg

File Metadata

Mime Type
text/x-diff
Expires
Wed, Feb 26, 9:57 PM (9 h, 59 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1465801
Default Alt Text
(48 KB)

Event Timeline