From 9da745252de5315be8329654ff185c0e69d222dd Mon Sep 17 00:00:00 2001 From: des Date: Tue, 8 Aug 2006 07:47:52 +0000 Subject: [PATCH] Autodetect the availability of kqueue() and / or poll(). git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@764 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_acceptor.c | 13 +++++++++++-- varnish-cache/configure.ac | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index dbd793d8..884a812a 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -6,8 +6,16 @@ * write the session pointer to a pipe which the event engine monitors. */ +#undef ACCEPTOR_USE_KQUEUE #undef ACCEPTOR_USE_POLL -#define ACCEPTOR_USE_KQUEUE + +#if defined(HAVE_KQUEUE) +#define ACCEPTOR_USE_KQUEUE 1 +#elif defined(HAVE_POLL) +#define ACCEPTOR_USE_POLL 1 +#else +#error No usable acceptors detected. +#endif #include #include @@ -95,7 +103,7 @@ vca_handover(struct sess *sp, int bad) /*====================================================================*/ #ifdef ACCEPTOR_USE_POLL -#include +#include static struct pollfd *pollfd; static unsigned npoll; @@ -262,6 +270,7 @@ vca_return_session(struct sess *sp) #endif /* ACCEPTOR_USE_POLL */ /*====================================================================*/ #ifdef ACCEPTOR_USE_KQUEUE + #include static int kq = -1; diff --git a/varnish-cache/configure.ac b/varnish-cache/configure.ac index 3e839329..586965ca 100644 --- a/varnish-cache/configure.ac +++ b/varnish-cache/configure.ac @@ -85,12 +85,17 @@ AC_CHECK_DECL([SO_ACCEPTFILER], AC_CHECK_LIB(rt, clock_gettime, need_librt=yes) AM_CONDITIONAL(NEED_LIBRT, test x$need_librt = xyes) +# Check for the presence of RSA's MD5 implementation (libmd on *BSD) AC_CHECK_HEADERS([md5.h]) if test x$ac_cv_header_md5_h = xyes ; then AC_CHECK_LIB(md, MD5Init, need_libmd=yes) fi AM_CONDITIONAL(NEED_LIBMD, test x$need_libmd = xyes) +# Check which mechanism to use for the acceptor +AC_CHECK_FUNCS([kqueue]) +AC_CHECK_FUNCS([poll]) + AC_CONFIG_FILES([ Makefile bin/Makefile -- 2.39.5