]> 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>
Thu, 27 Dec 2012 01:42:48 +0000 (14:42 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 27 Dec 2012 01:42:48 +0000 (14:42 +1300)
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().

configure.ac

index 52a2b3fbfc0e97d4b1a321efa15c6c05271c433e..1e15ea986ba13ecc2022d99533c59476ac658f07 100644 (file)
@@ -1318,18 +1318,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,
@@ -3173,7 +3184,6 @@ AC_CHECK_FUNCS(\
        glob \
        htobe16 \
        htole16 \
-       kqueue\
        lrand48 \
        mallinfo \
        mallocblksize \
@@ -3241,7 +3251,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"