r764 - in trunk/varnish-cache: . bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Tue Aug 8 09:47:52 CEST 2006


Author: des
Date: 2006-08-08 09:47:52 +0200 (Tue, 08 Aug 2006)
New Revision: 764

Modified:
   trunk/varnish-cache/bin/varnishd/cache_acceptor.c
   trunk/varnish-cache/configure.ac
Log:
Autodetect the availability of kqueue() and / or poll().

Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2006-08-08 07:47:12 UTC (rev 763)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c	2006-08-08 07:47:52 UTC (rev 764)
@@ -6,9 +6,17 @@
  * 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>
 #include <string.h>
@@ -95,7 +103,7 @@
 /*====================================================================*/
 #ifdef ACCEPTOR_USE_POLL
 
-#include <poll.h>
+#include <sys/poll.h>
 
 static struct pollfd *pollfd;
 static unsigned npoll;
@@ -262,6 +270,7 @@
 #endif /* ACCEPTOR_USE_POLL */
 /*====================================================================*/
 #ifdef ACCEPTOR_USE_KQUEUE
+
 #include <sys/event.h>
 
 static int kq = -1;

Modified: trunk/varnish-cache/configure.ac
===================================================================
--- trunk/varnish-cache/configure.ac	2006-08-08 07:47:12 UTC (rev 763)
+++ trunk/varnish-cache/configure.ac	2006-08-08 07:47:52 UTC (rev 764)
@@ -85,12 +85,17 @@
 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




More information about the varnish-commit mailing list