mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-10 04:50:37 -04:00
Merge remote branch 'origin/patches-2.0'
This branch is the big one that merges all the ntp folks' changes Conflicts: configure.in
This commit is contained in:
commit
a11c30b5fe
19
Makefile.am
19
Makefile.am
@ -59,7 +59,7 @@ VERSION_INFO = 1:0:0
|
|||||||
dist_bin_SCRIPTS = event_rpcgen.py
|
dist_bin_SCRIPTS = event_rpcgen.py
|
||||||
|
|
||||||
pkgconfigdir=$(libdir)/pkgconfig
|
pkgconfigdir=$(libdir)/pkgconfig
|
||||||
pkgconfig_DATA=libevent.pc
|
LIBEVENT_PKGCONFIG=libevent.pc
|
||||||
|
|
||||||
# These sources are conditionally added by configure.in or conditionally
|
# These sources are conditionally added by configure.in or conditionally
|
||||||
# included from other files.
|
# included from other files.
|
||||||
@ -76,14 +76,21 @@ EXTRA_DIST = \
|
|||||||
Makefile.nmake test/Makefile.nmake \
|
Makefile.nmake test/Makefile.nmake \
|
||||||
$(PLATFORM_DEPENDENT_SRC)
|
$(PLATFORM_DEPENDENT_SRC)
|
||||||
|
|
||||||
lib_LTLIBRARIES = libevent.la libevent_core.la libevent_extra.la
|
LIBEVENT_LIBS_LA = libevent.la libevent_core.la libevent_extra.la
|
||||||
if PTHREADS
|
if PTHREADS
|
||||||
lib_LTLIBRARIES += libevent_pthreads.la
|
LIBEVENT_LIBS_LA += libevent_pthreads.la
|
||||||
pkgconfig_DATA += libevent_pthreads.pc
|
LIBEVENT_PKGCONFIG += libevent_pthreads.pc
|
||||||
endif
|
endif
|
||||||
if OPENSSL
|
if OPENSSL
|
||||||
lib_LTLIBRARIES += libevent_openssl.la
|
LIBEVENT_LIBS_LA += libevent_openssl.la
|
||||||
pkgconfig_DATA += libevent_openssl.pc
|
LIBEVENT_PKGCONFIG += libevent_openssl.pc
|
||||||
|
endif
|
||||||
|
|
||||||
|
if INSTALL_LIBEVENT
|
||||||
|
lib_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
|
||||||
|
pkgconfig_DATA = $(LIBEVENT_PKGCONFIG)
|
||||||
|
else
|
||||||
|
noinst_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS = . include sample test
|
SUBDIRS = . include sample test
|
||||||
|
96
configure.in
96
configure.in
@ -25,6 +25,18 @@ AC_GNU_SOURCE
|
|||||||
AC_MINIX
|
AC_MINIX
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_CANONICAL_BUILD
|
||||||
|
AC_CANONICAL_HOST
|
||||||
|
dnl the 'build' machine is where we run configure and compile
|
||||||
|
dnl the 'host' machine is where the resulting stuff runs.
|
||||||
|
|
||||||
|
#case "$host_os" in
|
||||||
|
#
|
||||||
|
# osf5*)
|
||||||
|
# CFLAGS="$CFLAGS -D_OSF_SOURCE"
|
||||||
|
# ;;
|
||||||
|
#esac
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
@ -55,6 +67,16 @@ AC_ARG_ENABLE(openssl,
|
|||||||
AC_ARG_ENABLE(debug-mode,
|
AC_ARG_ENABLE(debug-mode,
|
||||||
AS_HELP_STRING(--disable-debug-mode, disable support for running in debug mode),
|
AS_HELP_STRING(--disable-debug-mode, disable support for running in debug mode),
|
||||||
[], [enable_debug_mode=yes])
|
[], [enable_debug_mode=yes])
|
||||||
|
AC_ARG_ENABLE([libevent-install],
|
||||||
|
AS_HELP_STRING([--disable-libevent-install, disable installation of libevent]),
|
||||||
|
[], [enable_libevent_install=yes])
|
||||||
|
AC_ARG_ENABLE([libevent-regress],
|
||||||
|
AS_HELP_STRING([--disable-libevent-regress, skip regress in make check]),
|
||||||
|
[], [enable_libevent_regress=yes])
|
||||||
|
AC_ARG_ENABLE([function-sections],
|
||||||
|
AS_HELP_STRING([--enable-function-sections, make static library allow smaller binaries with --gc-sections]),
|
||||||
|
[], [enable_function_sections=no])
|
||||||
|
|
||||||
|
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
|
|
||||||
@ -64,6 +86,14 @@ dnl the command line with --enable-shared and --disable-shared.
|
|||||||
dnl AC_DISABLE_SHARED
|
dnl AC_DISABLE_SHARED
|
||||||
AC_SUBST(LIBTOOL_DEPS)
|
AC_SUBST(LIBTOOL_DEPS)
|
||||||
|
|
||||||
|
AM_CONDITIONAL([BUILD_REGRESS], [test "$enable_libevent_regress" = "yes"])
|
||||||
|
if test "$enable_libevent_regress" = "yes" ; then
|
||||||
|
CHECK_REGRESS=regress
|
||||||
|
else
|
||||||
|
CHECK_REGRESS=
|
||||||
|
fi
|
||||||
|
AC_SUBST([CHECK_REGRESS])
|
||||||
|
|
||||||
dnl Checks for libraries.
|
dnl Checks for libraries.
|
||||||
AC_SEARCH_LIBS([inet_ntoa], [nsl])
|
AC_SEARCH_LIBS([inet_ntoa], [nsl])
|
||||||
AC_SEARCH_LIBS([socket], [socket])
|
AC_SEARCH_LIBS([socket], [socket])
|
||||||
@ -71,6 +101,9 @@ AC_SEARCH_LIBS([inet_aton], [resolv])
|
|||||||
AC_SEARCH_LIBS([clock_gettime], [rt])
|
AC_SEARCH_LIBS([clock_gettime], [rt])
|
||||||
AC_SEARCH_LIBS([sendfile], [sendfile])
|
AC_SEARCH_LIBS([sendfile], [sendfile])
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([zlib.h])
|
||||||
|
|
||||||
|
if test "x$ac_cv_header_zlib_h" = "xyes"; then
|
||||||
dnl Determine if we have zlib for regression tests
|
dnl Determine if we have zlib for regression tests
|
||||||
dnl Don't put this one in LIBS
|
dnl Don't put this one in LIBS
|
||||||
save_LIBS="$LIBS"
|
save_LIBS="$LIBS"
|
||||||
@ -83,6 +116,7 @@ AC_SEARCH_LIBS([inflateEnd], [z],
|
|||||||
AC_DEFINE(HAVE_LIBZ, 1, [Define if the system has zlib])])
|
AC_DEFINE(HAVE_LIBZ, 1, [Define if the system has zlib])])
|
||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
AC_SUBST(ZLIB_LIBS)
|
AC_SUBST(ZLIB_LIBS)
|
||||||
|
fi
|
||||||
AM_CONDITIONAL(ZLIB_REGRESS, [test "$have_zlib" = "yes"])
|
AM_CONDITIONAL(ZLIB_REGRESS, [test "$have_zlib" = "yes"])
|
||||||
|
|
||||||
dnl See if we have openssl. This doesn't go in LIBS either.
|
dnl See if we have openssl. This doesn't go in LIBS either.
|
||||||
@ -101,7 +135,7 @@ fi
|
|||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS(fcntl.h stdarg.h inttypes.h stdint.h stddef.h poll.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/param.h sys/ioctl.h sys/select.h sys/devpoll.h port.h netinet/in.h netinet/in6.h sys/socket.h sys/uio.h arpa/inet.h sys/eventfd.h sys/mman.h sys/sendfile.h sys/wait.h netdb.h)
|
AC_CHECK_HEADERS([fcntl.h stdarg.h inttypes.h stdint.h stddef.h poll.h unistd.h sys/epoll.h sys/time.h sys/queue.h sys/event.h sys/param.h sys/ioctl.h sys/select.h sys/devpoll.h port.h netinet/in.h netinet/in6.h sys/socket.h sys/uio.h arpa/inet.h sys/eventfd.h sys/mman.h sys/sendfile.h sys/wait.h netdb.h])
|
||||||
AC_CHECK_HEADERS(sys/sysctl.h, [], [], [
|
AC_CHECK_HEADERS(sys/sysctl.h, [], [], [
|
||||||
#ifdef HAVE_SYS_PARAM_H
|
#ifdef HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -210,10 +244,32 @@ AC_C_INLINE
|
|||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
|
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_CHECK_FUNCS(gettimeofday vasprintf fcntl clock_gettime strtok_r strsep getaddrinfo getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getservbyname getprotobynumber setenv unsetenv putenv)
|
AC_CHECK_FUNCS([gettimeofday vasprintf fcntl clock_gettime strtok_r strsep])
|
||||||
|
AC_CHECK_FUNCS([getnameinfo strlcpy inet_ntop inet_pton signal sigaction strtoll inet_aton pipe eventfd sendfile mmap splice arc4random arc4random_buf issetugid geteuid getegid getprotobynumber setenv unsetenv putenv])
|
||||||
|
|
||||||
if test "$ac_cv_func_getaddrinfo" != "yes" ; then
|
AC_CACHE_CHECK(
|
||||||
|
[for getaddrinfo],
|
||||||
|
[libevent_cv_getaddrinfo],
|
||||||
|
[AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[
|
||||||
|
#ifdef HAVE_NETDB_H
|
||||||
|
#include <netdb.h>
|
||||||
|
#endif
|
||||||
|
]],
|
||||||
|
[[
|
||||||
|
getaddrinfo;
|
||||||
|
]]
|
||||||
|
)],
|
||||||
|
[libevent_cv_getaddrinfo=yes],
|
||||||
|
[libevent_cv_getaddrinfo=no]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
if test "$libevent_cv_getaddrinfo" = "yes" ; then
|
||||||
|
AC_DEFINE([HAVE_GETADDRINFO], [1], [Do we have getaddrinfo()?])
|
||||||
|
else
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([getservbyname])
|
||||||
# Check for gethostbyname_r in all its glorious incompatible versions.
|
# Check for gethostbyname_r in all its glorious incompatible versions.
|
||||||
# (This is cut-and-pasted from Tor, which based its logic on
|
# (This is cut-and-pasted from Tor, which based its logic on
|
||||||
# Python's configure.in.)
|
# Python's configure.in.)
|
||||||
@ -613,5 +669,39 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
LIBEVENT_GC_SECTIONS=
|
||||||
|
if test "$GCC" = yes && test "$enable_function_sections" = yes ; then
|
||||||
|
AC_CACHE_CHECK(
|
||||||
|
[if linker supports omitting unused code and data],
|
||||||
|
[libevent_cv_gc_sections_works],
|
||||||
|
[
|
||||||
|
origCFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -Wl,--gc-sections"
|
||||||
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[
|
||||||
|
if grep gc-sections conftest.err ; then
|
||||||
|
libevent_cv_gc_sections_works=no
|
||||||
|
else
|
||||||
|
libevent_cv_gc_sections_works=yes
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[libevent_cv_gc_sections_works=no]
|
||||||
|
)
|
||||||
|
CFLAGS="$origCFLAGS"
|
||||||
|
AS_UNSET([origCFLAGS])
|
||||||
|
]
|
||||||
|
)
|
||||||
|
case "$libevent_cv_gc_sections_works" in
|
||||||
|
yes)
|
||||||
|
CFLAGS="-ffunction-sections -fdata-sections $CFLAGS"
|
||||||
|
LIBEVENT_GC_SECTIONS="-Wl,--gc-sections"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
AC_SUBST([LIBEVENT_GC_SECTIONS])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([INSTALL_LIBEVENT], [test "$enable_libevent_install" = "yes"])
|
||||||
|
|
||||||
AC_CONFIG_FILES( [libevent.pc libevent_openssl.pc libevent_pthreads.pc] )
|
AC_CONFIG_FILES( [libevent.pc libevent_openssl.pc libevent_pthreads.pc] )
|
||||||
AC_OUTPUT(Makefile include/Makefile test/Makefile sample/Makefile)
|
AC_OUTPUT(Makefile include/Makefile test/Makefile sample/Makefile)
|
||||||
|
3
http.c
3
http.c
@ -57,6 +57,9 @@
|
|||||||
#ifdef _EVENT_HAVE_NETINET_IN_H
|
#ifdef _EVENT_HAVE_NETINET_IN_H
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _EVENT_HAVE_ARPA_INET_H
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#endif
|
||||||
#ifdef _EVENT_HAVE_NETDB_H
|
#ifdef _EVENT_HAVE_NETDB_H
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,6 +107,10 @@ int event_reinit(struct event_base *base);
|
|||||||
/**
|
/**
|
||||||
Threadsafe event dispatching loop.
|
Threadsafe event dispatching loop.
|
||||||
|
|
||||||
|
This loop will run the event base until either there are no more added
|
||||||
|
events, or until something calls event_base_loopbreak() or
|
||||||
|
evenet_base_loopexit().
|
||||||
|
|
||||||
@param eb the event_base structure returned by event_init()
|
@param eb the event_base structure returned by event_init()
|
||||||
@see event_init(), event_dispatch()
|
@see event_init(), event_dispatch()
|
||||||
*/
|
*/
|
||||||
@ -322,7 +326,7 @@ void event_set_fatal_callback(event_fatal_cb cb);
|
|||||||
int event_base_set(struct event_base *, struct event *);
|
int event_base_set(struct event_base *, struct event *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
event_loop() flags
|
event_base_loop() flags
|
||||||
*/
|
*/
|
||||||
/*@{*/
|
/*@{*/
|
||||||
/** Block until we have an active event, then exit once all active events
|
/** Block until we have an active event, then exit once all active events
|
||||||
@ -338,6 +342,11 @@ int event_base_set(struct event_base *, struct event *);
|
|||||||
|
|
||||||
This is a more flexible version of event_base_dispatch().
|
This is a more flexible version of event_base_dispatch().
|
||||||
|
|
||||||
|
By default, this loop will run the event base until either there are no more
|
||||||
|
added events, or until something calls event_base_loopbreak() or
|
||||||
|
evenet_base_loopexit(). You can override this behavior with the 'flags'
|
||||||
|
argument.
|
||||||
|
|
||||||
@param eb the event_base structure returned by event_init()
|
@param eb the event_base structure returned by event_init()
|
||||||
@param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK
|
@param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK
|
||||||
@return 0 if successful, -1 if an error occurred, or 1 if no events were
|
@return 0 if successful, -1 if an error occurred, or 1 if no events were
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign no-dependencies
|
AUTOMAKE_OPTIONS = foreign no-dependencies
|
||||||
|
|
||||||
LDADD = ../libevent.la
|
LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
|
||||||
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include
|
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include
|
||||||
|
|
||||||
noinst_PROGRAMS = event-test time-test signal-test dns-example hello-world http-server
|
noinst_PROGRAMS = event-test time-test signal-test dns-example hello-world http-server
|
||||||
|
@ -7,6 +7,9 @@
|
|||||||
|
|
||||||
#include <event2/event-config.h>
|
#include <event2/event-config.h>
|
||||||
|
|
||||||
|
/* Compatibility for possible missing IPv6 declarations */
|
||||||
|
#include "../ipv6-internal.h"
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
# ifdef _XOPEN_SOURCE_EXTENDED
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# endif
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -36,8 +36,14 @@
|
|||||||
|
|
||||||
#ifdef _EVENT_HAVE_NETINET_IN_H
|
#ifdef _EVENT_HAVE_NETINET_IN_H
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
# ifdef _XOPEN_SOURCE_EXTENDED
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Compatibility for possible missing IPv6 declarations */
|
||||||
|
#include "../util-internal.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define stat _stat
|
#define stat _stat
|
||||||
#define fstat _fstat
|
#define fstat _fstat
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
AM_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include -DTINYTEST_LOCAL
|
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat -I$(top_srcdir)/include -I../include -DTINYTEST_LOCAL
|
||||||
|
|
||||||
EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c test.sh
|
EXTRA_DIST = regress.rpc regress.gen.h regress.gen.c test.sh
|
||||||
|
|
||||||
noinst_PROGRAMS = test-init test-eof test-weof test-time regress \
|
noinst_PROGRAMS = test-init test-eof test-weof test-time @CHECK_REGRESS@ \
|
||||||
bench bench_cascade bench_http bench_httpclient test-ratelim \
|
bench bench_cascade bench_http bench_httpclient test-ratelim \
|
||||||
test-changelist
|
test-changelist
|
||||||
|
EXTRA_PROGRAMS = regress
|
||||||
noinst_HEADERS = tinytest.h tinytest_macros.h regress.h tinytest_local.h
|
noinst_HEADERS = tinytest.h tinytest_macros.h regress.h tinytest_local.h
|
||||||
|
|
||||||
TESTS = $(top_srcdir)/test/test.sh
|
TESTS = $(top_srcdir)/test/test.sh
|
||||||
|
|
||||||
BUILT_SOURCES = regress.gen.c regress.gen.h
|
BUILT_SOURCES =
|
||||||
|
if BUILD_REGRESS
|
||||||
|
BUILT_SOURCES += regress.gen.c regress.gen.h
|
||||||
|
endif
|
||||||
|
|
||||||
test_init_SOURCES = test-init.c
|
test_init_SOURCES = test-init.c
|
||||||
test_init_LDADD = ../libevent_core.la
|
test_init_LDADD = ../libevent_core.la
|
||||||
test_eof_SOURCES = test-eof.c
|
test_eof_SOURCES = test-eof.c
|
||||||
@ -45,7 +50,7 @@ if BUILD_WIN32
|
|||||||
regress_SOURCES += regress_iocp.c
|
regress_SOURCES += regress_iocp.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
regress_LDADD = ../libevent.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
|
regress_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la $(PTHREAD_LIBS) $(ZLIB_LIBS)
|
||||||
regress_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat \
|
regress_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/compat \
|
||||||
-I$(top_srcdir)/include -I../include $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
|
-I$(top_srcdir)/include -I../include $(PTHREAD_CFLAGS) $(ZLIB_CFLAGS)
|
||||||
regress_LDFLAGS = $(PTHREAD_CFLAGS)
|
regress_LDFLAGS = $(PTHREAD_CFLAGS)
|
||||||
@ -56,13 +61,13 @@ regress_LDADD += ../libevent_openssl.la -lcrypto -lssl
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
bench_SOURCES = bench.c
|
bench_SOURCES = bench.c
|
||||||
bench_LDADD = ../libevent.la
|
bench_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
|
||||||
bench_cascade_SOURCES = bench_cascade.c
|
bench_cascade_SOURCES = bench_cascade.c
|
||||||
bench_cascade_LDADD = ../libevent.la
|
bench_cascade_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
|
||||||
bench_http_SOURCES = bench_http.c
|
bench_http_SOURCES = bench_http.c
|
||||||
bench_http_LDADD = ../libevent.la
|
bench_http_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent.la
|
||||||
bench_httpclient_SOURCES = bench_httpclient.c
|
bench_httpclient_SOURCES = bench_httpclient.c
|
||||||
bench_httpclient_LDADD = ../libevent_core.la
|
bench_httpclient_LDADD = $(LIBEVENT_GC_SECTIONS) ../libevent_core.la
|
||||||
|
|
||||||
regress.gen.c regress.gen.h: regress.rpc $(top_srcdir)/event_rpcgen.py
|
regress.gen.c regress.gen.h: regress.rpc $(top_srcdir)/event_rpcgen.py
|
||||||
$(top_srcdir)/event_rpcgen.py $(srcdir)/regress.rpc || echo "No Python installed"
|
$(top_srcdir)/event_rpcgen.py $(srcdir)/regress.rpc || echo "No Python installed"
|
||||||
|
@ -31,6 +31,9 @@
|
|||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
# ifdef _XOPEN_SOURCE_EXTENDED
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
@ -71,6 +71,8 @@
|
|||||||
#include "regress.h"
|
#include "regress.h"
|
||||||
#include "regress_testutils.h"
|
#include "regress_testutils.h"
|
||||||
|
|
||||||
|
#include "../util-internal.h"
|
||||||
|
|
||||||
static int dns_ok = 0;
|
static int dns_ok = 0;
|
||||||
static int dns_got_cancel = 0;
|
static int dns_got_cancel = 0;
|
||||||
static int dns_err = 0;
|
static int dns_err = 0;
|
||||||
|
@ -34,6 +34,9 @@
|
|||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
# ifdef _XOPEN_SOURCE_EXTENDED
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@
|
|||||||
#include "regress.h"
|
#include "regress.h"
|
||||||
#include "regress_testutils.h"
|
#include "regress_testutils.h"
|
||||||
|
|
||||||
|
#include "../util-internal.h"
|
||||||
|
|
||||||
/* globals */
|
/* globals */
|
||||||
static struct evdns_server_port *dns_port;
|
static struct evdns_server_port *dns_port;
|
||||||
evutil_socket_t dns_sock = -1;
|
evutil_socket_t dns_sock = -1;
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
int test_okay = 1;
|
int test_okay = 1;
|
||||||
int called = 0;
|
int called = 0;
|
||||||
|
struct timeval timeout = {60, 0};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_cb(evutil_socket_t fd, short event, void *arg)
|
read_cb(evutil_socket_t fd, short event, void *arg)
|
||||||
@ -39,6 +40,11 @@ read_cb(evutil_socket_t fd, short event, void *arg)
|
|||||||
char buf[256];
|
char buf[256];
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
|
if (EV_TIMEOUT & event) {
|
||||||
|
printf("%s: Timeout!\n", __func__);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
len = recv(fd, buf, sizeof(buf), 0);
|
len = recv(fd, buf, sizeof(buf), 0);
|
||||||
|
|
||||||
printf("%s: read %d%s\n", __func__,
|
printf("%s: read %d%s\n", __func__,
|
||||||
@ -46,7 +52,7 @@ read_cb(evutil_socket_t fd, short event, void *arg)
|
|||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
if (!called)
|
if (!called)
|
||||||
event_add(arg, NULL);
|
event_add(arg, &timeout);
|
||||||
} else if (called == 1)
|
} else if (called == 1)
|
||||||
test_okay = 0;
|
test_okay = 0;
|
||||||
|
|
||||||
@ -85,9 +91,9 @@ main(int argc, char **argv)
|
|||||||
event_init();
|
event_init();
|
||||||
|
|
||||||
/* Initalize one event */
|
/* Initalize one event */
|
||||||
event_set(&ev, pair[1], EV_READ, read_cb, &ev);
|
event_set(&ev, pair[1], EV_READ | EV_TIMEOUT, read_cb, &ev);
|
||||||
|
|
||||||
event_add(&ev, NULL);
|
event_add(&ev, &timeout);
|
||||||
|
|
||||||
event_dispatch();
|
event_dispatch();
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@
|
|||||||
#else
|
#else
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
|
# ifdef _XOPEN_SOURCE_EXTENDED
|
||||||
|
# include <arpa/inet.h>
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
@ -46,6 +49,8 @@
|
|||||||
#include "event2/listener.h"
|
#include "event2/listener.h"
|
||||||
#include "event2/thread.h"
|
#include "event2/thread.h"
|
||||||
|
|
||||||
|
#include "../util-internal.h"
|
||||||
|
|
||||||
static int cfg_verbose = 0;
|
static int cfg_verbose = 0;
|
||||||
static int cfg_help = 0;
|
static int cfg_help = 0;
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@ fi
|
|||||||
|
|
||||||
# /bin/echo is a little more likely to support -n than sh's builtin echo,
|
# /bin/echo is a little more likely to support -n than sh's builtin echo,
|
||||||
# printf is even more likely
|
# printf is even more likely
|
||||||
if test "`printf hello 2>&1`" = "hello"
|
if test "`printf %s hello 2>&1`" = "hello"
|
||||||
then
|
then
|
||||||
ECHO_N="printf"
|
ECHO_N="printf %s"
|
||||||
else
|
else
|
||||||
if test -x /bin/echo
|
if test -x /bin/echo
|
||||||
then
|
then
|
||||||
@ -97,6 +97,7 @@ run_tests () {
|
|||||||
announce FAILED ;
|
announce FAILED ;
|
||||||
FAILED=yes
|
FAILED=yes
|
||||||
fi
|
fi
|
||||||
|
test -x $TEST_DIR/regress || return
|
||||||
announce_n " regress: "
|
announce_n " regress: "
|
||||||
if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
|
if test "$TEST_OUTPUT_FILE" = "/dev/null" ;
|
||||||
then
|
then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user