From: Timo Sirainen Date: Sun, 4 Apr 2010 20:18:25 +0000 (+0300) Subject: epoll: Improved error messages. X-Git-Tag: 2.0.beta5~247 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=debb28d107fa06d26fd194fdac523cfb32809199;p=thirdparty%2Fdovecot%2Fcore.git epoll: Improved error messages. --HG-- branch : HEAD --- diff --git a/src/lib/ioloop-epoll.c b/src/lib/ioloop-epoll.c index e5ccd9fca0..f22bafee92 100644 --- a/src/lib/ioloop-epoll.c +++ b/src/lib/ioloop-epoll.c @@ -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) {