Commit 937321f8 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Autodetect the availability of kqueue() and / or poll().

git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@764 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 32ff161c
...@@ -6,8 +6,16 @@ ...@@ -6,8 +6,16 @@
* write the session pointer to a pipe which the event engine monitors. * write the session pointer to a pipe which the event engine monitors.
*/ */
#undef ACCEPTOR_USE_KQUEUE
#undef ACCEPTOR_USE_POLL #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 <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
...@@ -95,7 +103,7 @@ vca_handover(struct sess *sp, int bad) ...@@ -95,7 +103,7 @@ vca_handover(struct sess *sp, int bad)
/*====================================================================*/ /*====================================================================*/
#ifdef ACCEPTOR_USE_POLL #ifdef ACCEPTOR_USE_POLL
#include <poll.h> #include <sys/poll.h>
static struct pollfd *pollfd; static struct pollfd *pollfd;
static unsigned npoll; static unsigned npoll;
...@@ -262,6 +270,7 @@ vca_return_session(struct sess *sp) ...@@ -262,6 +270,7 @@ vca_return_session(struct sess *sp)
#endif /* ACCEPTOR_USE_POLL */ #endif /* ACCEPTOR_USE_POLL */
/*====================================================================*/ /*====================================================================*/
#ifdef ACCEPTOR_USE_KQUEUE #ifdef ACCEPTOR_USE_KQUEUE
#include <sys/event.h> #include <sys/event.h>
static int kq = -1; static int kq = -1;
......
...@@ -85,12 +85,17 @@ AC_CHECK_DECL([SO_ACCEPTFILER], ...@@ -85,12 +85,17 @@ AC_CHECK_DECL([SO_ACCEPTFILER],
AC_CHECK_LIB(rt, clock_gettime, need_librt=yes) AC_CHECK_LIB(rt, clock_gettime, need_librt=yes)
AM_CONDITIONAL(NEED_LIBRT, test x$need_librt = xyes) 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]) AC_CHECK_HEADERS([md5.h])
if test x$ac_cv_header_md5_h = xyes ; then if test x$ac_cv_header_md5_h = xyes ; then
AC_CHECK_LIB(md, MD5Init, need_libmd=yes) AC_CHECK_LIB(md, MD5Init, need_libmd=yes)
fi fi
AM_CONDITIONAL(NEED_LIBMD, test x$need_libmd = xyes) 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([ AC_CONFIG_FILES([
Makefile Makefile
bin/Makefile bin/Makefile
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment