]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
epoll: Improved error messages.
authorTimo Sirainen <tss@iki.fi>
Sun, 4 Apr 2010 20:18:25 +0000 (23:18 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 4 Apr 2010 20:18:25 +0000 (23:18 +0300)
--HG--
branch : HEAD

src/lib/ioloop-epoll.c

index e5ccd9fca064d3c1c3eb9545d9ed2fad95ff00e2..f22bafee92851ea758f6f99dc8681d81c7e51cd8 100644 (file)
@@ -110,8 +110,12 @@ void io_loop_handle_add(struct io_file *io)
        op = first ? EPOLL_CTL_ADD : EPOLL_CTL_MOD;
 
        if (epoll_ctl(ctx->epfd, op, io->fd, &event) < 0) {
-               i_panic("io_loop_handle_add: epoll_ctl(%d, %d): %m",
-                       op, io->fd);
+               if (errno == EPERM && op == EPOLL_CTL_ADD) {
+                       i_fatal("epoll_ctl(add, %d) failed: %m "
+                               "(fd doesn't support epoll)", io->fd);
+               }
+               i_panic("epoll_ctl(%s, %d) failed: %m",
+                       op == EPOLL_CTL_ADD ? "add" : "mod", io->fd);
        }
 
        if (first) {
@@ -143,8 +147,8 @@ void io_loop_handle_remove(struct io_file *io, bool closed)
                op = last ? EPOLL_CTL_DEL : EPOLL_CTL_MOD;
 
                if (epoll_ctl(ctx->epfd, op, io->fd, &event) < 0) {
-                       i_error("io_loop_handle_remove: epoll_ctl(%d, %d): %m",
-                               op, io->fd);
+                       i_error("epoll_ctl(%s, %d) failed: %m",
+                               op == EPOLL_CTL_DEL ? "del" : "mod", io->fd);
                }
        }
        if (last) {