mirror of
https://github.com/ceph/ceph
synced 2025-04-19 05:46:09 +00:00
Merge pull request #1043 from ceph/port/misc
misc portability patches Reviewed-by: Sage Weil <sage@inktank.com>
This commit is contained in:
commit
5300ed9428
10
configure.ac
10
configure.ac
@ -171,10 +171,14 @@ if test x"$resolv_libs" != "xok"; then
|
||||
fi
|
||||
AC_SUBST([RESOLV_LIBS])
|
||||
|
||||
dnl check for libkeyutils on linux
|
||||
KEYUTILS_LIB=""
|
||||
AS_IF([test x"$linux" = x"yes"], [
|
||||
AC_CHECK_LIB([keyutils], [add_key], [KEYUTILS_LIB="-lkeyutils"], [
|
||||
AC_MSG_FAILURE([libkeyutils not found])])])
|
||||
AC_SUBST(KEYUTILS_LIB)
|
||||
|
||||
AC_CHECK_LIB([m], [pow], [true], AC_MSG_FAILURE([libm not found]))
|
||||
if test x"$linux" = x"yes"; then
|
||||
AC_CHECK_LIB([keyutils], [add_key], [true], AC_MSG_FAILURE([libkeyutils not found]))
|
||||
fi
|
||||
AC_CHECK_FUNCS([syncfs], AC_DEFINE([HAVE_SYS_SYNCFS], [1], [we have syncfs]), [])
|
||||
|
||||
# Find some crypto library for us to use, while letting user to decide which one to use.
|
||||
|
@ -116,7 +116,7 @@ AM_CCASFLAGS = -f elf64
|
||||
#####################
|
||||
## library definitions and dependencies
|
||||
|
||||
EXTRALIBS = -luuid -lm -lkeyutils
|
||||
EXTRALIBS = -luuid -lm $(KEYUTILS_LIB)
|
||||
if FREEBSD
|
||||
EXTRALIBS += -lexecinfo
|
||||
endif # FREEBSD
|
||||
|
@ -112,7 +112,7 @@ noinst_HEADERS += \
|
||||
LIBCOMMON_DEPS += \
|
||||
$(LIBMSG) $(LIBAUTH) \
|
||||
$(LIBCRUSH) $(LIBJSON_SPIRIT) $(LIBLOG) $(LIBARCH) \
|
||||
-lkeyutils
|
||||
$(KEYUTILS_LIB)
|
||||
|
||||
if LINUX
|
||||
LIBCOMMON_DEPS += -lrt
|
||||
|
@ -80,7 +80,7 @@ const struct sockaddr *find_ipv6_in_subnet(const struct ifaddrs *addrs,
|
||||
struct in6_addr *cur = &((struct sockaddr_in6*)addrs->ifa_addr)->sin6_addr;
|
||||
netmask_ipv6(cur, prefix_len, &temp);
|
||||
|
||||
if (memcmp(temp.s6_addr32, want.s6_addr32, sizeof(temp)) == 0)
|
||||
if (IN6_ARE_ADDR_EQUAL(&temp, &want))
|
||||
return addrs->ifa_addr;
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,25 @@ ostream& Pipe::_pipe_prefix(std::ostream *_dout) {
|
||||
<< ").";
|
||||
}
|
||||
|
||||
/*
|
||||
* This optimization may not be available on all platforms (e.g. OSX).
|
||||
* Apparently a similar approach based on TCP_CORK can be used.
|
||||
*/
|
||||
#ifndef MSG_MORE
|
||||
# define MSG_MORE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On BSD SO_NOSIGPIPE can be set via setsockopt to block SIGPIPE.
|
||||
*/
|
||||
#ifndef MSG_NOSIGNAL
|
||||
# define MSG_NOSIGNAL 0
|
||||
# ifdef SO_NOSIGPIPE
|
||||
# define CEPH_USE_SO_NOSIGPIPE
|
||||
# else
|
||||
# error "Cannot block SIGPIPE!"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/**************************************
|
||||
* Pipe
|
||||
@ -754,6 +772,16 @@ void Pipe::set_socket_options()
|
||||
ldout(msgr->cct,0) << "couldn't set SO_RCVBUF to " << size << ": " << cpp_strerror(r) << dendl;
|
||||
}
|
||||
}
|
||||
|
||||
// block ESIGPIPE
|
||||
#ifdef CEPH_USE_SO_NOSIGPIPE
|
||||
int val = 1;
|
||||
int r = ::setsockopt(sd, SOL_SOCKET, SO_NOSIGPIPE, (void*)&val, sizeof(val));
|
||||
if (r) {
|
||||
r = -errno;
|
||||
ldout(msgr->cct,0) << "couldn't set SO_NOSIGPIPE: " << cpp_strerror(r) << dendl;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int Pipe::connect()
|
||||
|
@ -192,6 +192,7 @@ bin_DEBUGPROGRAMS += ceph_erasure_code_benchmark
|
||||
|
||||
## System tests
|
||||
|
||||
if LINUX
|
||||
libsystest_la_SOURCES = \
|
||||
test/system/cross_process_sem.cc \
|
||||
test/system/systest_runnable.cc \
|
||||
@ -229,6 +230,7 @@ ceph_test_rados_watch_notify_SOURCES = \
|
||||
test/system/st_rados_notify.cc
|
||||
ceph_test_rados_watch_notify_LDADD = $(LIBRADOS) libsystest.la $(PTHREAD_LIBS)
|
||||
bin_DEBUGPROGRAMS += ceph_test_rados_watch_notify
|
||||
endif
|
||||
|
||||
ceph_bench_log_SOURCES = test/bench_log.cc
|
||||
ceph_bench_log_LDADD = $(CEPH_GLOBAL)
|
||||
|
Loading…
Reference in New Issue
Block a user