changeset 2569:554f1324a435 HEAD

Added epoll support if --with-ioloop=epoll is given. Patch by Andrey Panin.
author Timo Sirainen <tss@iki.fi>
date Mon, 06 Sep 2004 00:10:00 +0300
parents 69f1ba731c84
children 372d4b90c076
files configure.in src/lib/Makefile.am src/lib/ioloop-poll.c
diffstat 3 files changed, 34 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Sun Sep 05 23:29:04 2004 +0300
+++ b/configure.in	Mon Sep 06 00:10:00 2004 +0300
@@ -1,7 +1,7 @@
 AC_INIT(src)
 
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(dovecot, 1.0-test38)
+AM_INIT_AUTOMAKE(dovecot, 1.0-test40)
 
 AM_MAINTAINER_MODE
 
@@ -52,6 +52,11 @@
 	mem_align=$withval,
 	mem_align=8)
 
+AC_ARG_WITH(ioloop,
+[  --with-ioloop=IOLOOP    Specify the I/O loop method to use],
+	ioloop=$withval,
+	ioloop=)
+
 AC_ARG_WITH(passwd,
 [  --with-passwd           Build with /etc/passwd support (default)],
 	if test x$withval = xno; then
@@ -263,13 +268,32 @@
                strcasecmp stricmp vsnprintf vsyslog writev pread \
 	       setrlimit setproctitle)
 
-dnl * poll/select?
+dnl * I/O loop function
+have_ioloop=no
 
-AC_CHECK_FUNC(poll, [
-	AC_DEFINE(IOLOOP_POLL,, Implement I/O loop with poll())
-], [
-	AC_DEFINE(IOLOOP_SELECT,, Implement I/O loop with select())
-])
+dnl we currently don't use epoll automatically because it fails at runtime
+dnl if we're not running 2.6 kernel
+if test "$ioloop" = "epoll"; then
+  AC_CHECK_FUNC(epoll_create, [
+    AC_DEFINE(IOLOOP_EPOLL,, Implement I/O loop with Linux 2.6 epoll())
+    have_ioloop=yes
+  ], [
+    ioloop=""
+  ])
+fi
+
+if test "$ioloop" = "" || test "$ioloop" = "poll"; then
+  AC_CHECK_FUNC(poll, [
+    AC_DEFINE(IOLOOP_POLL,, Implement I/O loop with poll())
+    ioloop=poll
+    have_ioloop=yes
+  ])
+fi
+
+if test "$have_ioloop" = "no"; then
+  AC_DEFINE(IOLOOP_SELECT,, Implement I/O loop with select())
+  ioloop="select"
+fi
 
 dnl * dnotify?
 AC_TRY_COMPILE([
@@ -1371,6 +1395,7 @@
 echo
 echo "Install prefix ...................... : $prefix"
 echo "File offsets ........................ : ${offt_bits}bit"
+echo "I/O loop method ..................... : $ioloop"
 echo "Building with SSL support ........... : $have_ssl"
 echo "Building with IPv6 support .......... : $want_ipv6"
 echo "Building with pop3 server ........... : $want_pop3d"
--- a/src/lib/Makefile.am	Sun Sep 05 23:29:04 2004 +0300
+++ b/src/lib/Makefile.am	Mon Sep 06 00:10:00 2004 +0300
@@ -30,6 +30,7 @@
 	ioloop-notify-dn.c \
 	ioloop-poll.c \
 	ioloop-select.c \
+	ioloop-epoll.c \
 	lib.c \
 	lib-signals.c \
 	md4.c \
--- a/src/lib/ioloop-poll.c	Sun Sep 05 23:29:04 2004 +0300
+++ b/src/lib/ioloop-poll.c	Mon Sep 06 00:10:00 2004 +0300
@@ -141,7 +141,7 @@
 
 	ret = poll(data->fds, data->fds_pos, msecs);
 	if (ret < 0 && errno != EINTR)
-		i_warning("poll() : %m");
+		i_fatal("poll(): %m");
 
 	/* execute timeout handlers */
         io_loop_handle_timeouts(ioloop);