]> err.no Git - varnish/commitdiff
Autodetect the availability of kqueue() and / or poll().
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 8 Aug 2006 07:47:52 +0000 (07:47 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 8 Aug 2006 07:47:52 +0000 (07:47 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@764 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache_acceptor.c
varnish-cache/configure.ac

index dbd793d8da1f63a9e73314fb525fe013dbf949c2..884a812a53fa97ea029774aba64f3df89867d3f7 100644 (file)
@@ -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 <stdio.h>
 #include <errno.h>
@@ -95,7 +103,7 @@ vca_handover(struct sess *sp, int bad)
 /*====================================================================*/
 #ifdef ACCEPTOR_USE_POLL
 
-#include <poll.h>
+#include <sys/poll.h>
 
 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 <sys/event.h>
 
 static int kq = -1;
index 3e8393296d50c967b89be0bb6b432d459247e4cf..586965ca4394a32af39533f3acee4d6a2b3251b6 100644 (file)
@@ -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