]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
kqueue: update status from experimental to fully available net I/O method
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 2 Jan 2013 04:01:34 +0000 (21:01 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 2 Jan 2013 04:01:34 +0000 (21:01 -0700)
kqueue has been in use on FreeBSD and maybe others for some time now and
has less bugs than epoll. So the issues on record should not be held
against it.

The attached patch adds auto-detection for the kqueue dependencies and
enables it by default when it can build. Unfortunately due to the
dependencies we cannot add it to maximus layer for force-enable, but the
default layer will test it on FreeBSD at least. It is still less
preferred than epoll(), but more than select() and poll().

Also fixes bug 3716 "build error on FreeBSD in kqueue"

configure.ac
src/comm/ModKqueue.cc

index ec671e6f71f9db0a9ece56e8ae1de2cb2817735b..b84eca8fd2f08557dbcca49d98e445d3a39bd009 100644 (file)
@@ -1313,18 +1313,29 @@ test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
 ])
 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
 
-# kqueue support is still experiemntal and unstable. Not enabled by default.
 AC_ARG_ENABLE(kqueue,
-  AS_HELP_STRING([--enable-kqueue],
-                 [Enable kqueue(2) support (experimental).]), [
+  AS_HELP_STRING([--disable-kqueue],
+                 [Disable kqueue(2) support.]), [
 SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
 ])
-if test "x${enable_kqueue:=no}" = "xyes" ; then
-  AC_CHECK_HEADERS([sys/event.h],[],
-    [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ])
-  squid_opt_io_loop_engine="kqueue"
+if test "x${enable_kqueue:=auto}" != "xno" ; then
+  AC_CHECK_HEADERS([sys/event.h],[],[
+    if test "x${enable_kqueue}" = "xyes" ; then
+      AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
+    fi
+  ])
+  AC_CHECK_FUNCS(kqueue,[],[
+    if test "x${enable_kqueue}" = "xyes" ; then
+      AC_MSG_ERROR([kqueue support missing in libc library.])
+    fi
+  ])
+  if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
+    squid_opt_io_loop_engine="kqueue"
+  else
+    enable_kqueue="no"
+  fi
 fi
-AC_MSG_NOTICE([enabling kqueue for net I/O: $enable_kqueue])
+AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
 
 dnl Enable epoll()
 AC_ARG_ENABLE(epoll,
@@ -3160,7 +3171,6 @@ AC_CHECK_FUNCS(\
        glob \
        htobe16 \
        htole16 \
-       kqueue\
        lrand48 \
        mallinfo \
        mallocblksize \
@@ -3228,7 +3238,7 @@ if test "x$squid_opt_io_loop_engine" != "x"; then
        AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
 elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
   squid_opt_io_loop_engine="epoll"
-elif test "x$enable_kqueue" != "xno" -a "x$ac_cv_func_kqueue" = "xyes" ; then
+elif test "x$enable_kqueue" != "xno" ; then
   squid_opt_io_loop_engine="kqueue"
 elif test "x$enable_devpoll" != "xno" ; then
   squid_opt_io_loop_engine="devpoll"
index e8703c612ceb1e928a90888291222ecb35c9cc03..8b722246dbcd8a5ba6618636d99a13185efbf0e4 100644 (file)
@@ -55,6 +55,7 @@
 #if USE_KQUEUE
 #include "comm/Loops.h"
 #include "fde.h"
+#include "globals.h"
 #include "SquidTime.h"
 #include "StatCounters.h"
 #include "Store.h"