[dovecot] Re: PATCH Add support for kqueue in ioloop subsystem

Timo Sirainen tss at iki.fi
Wed Apr 16 23:16:35 EEST 2003


On Wed, 2003-04-16 at 22:33, Dominic Marks wrote:
> I noticed that there was an ioloop "module" (if we can call it that) for
> select and poll and decided to add one for kqueue (aka kevent) BSDs high
> performance descriptor multiplexing API. I haven't done any of the
> configure glue stuff but the code is complete and works well. kqueue is
> available on all recent versions of FreeBSD, NetBSD, OpenBSD and Darwin
> (and therefore MacOS X). I've tested both pop3 and imap with no
> problems.

Thanks. I'll add the configure stuff there. Some comments:

--
        if (kevent(data->kq, &data->event, 1, NULL, 0, NULL) < 0) {
                i_warning("couldn't add filter with kqueue: %m");
        }
--

Maybe that should be i_fatal() instead? Otherwise the socket would get
ignored and never closed.

--
        if (kevent(data->kq, &data->event, 1, NULL, 0, NULL) < 0) {
                /*
                 * changing this to i_fatal is debatable, however
                 * if you do so you will potentially expose the case
                 * where a process receives the client from a socket
                 * then closes the listening socket, experiences an
                 * error and calls exit, dropping the client we just
                 * picked up
                 */
                i_warning("couldn't remove filter with kqueue: %m");
        }
--

Can this error actually happen when removing it? What kind of error?

--
                 * in. However here we have to process them in io handler
                 * priority order, which means we then need to go through
                 * our events and see if we have a match.
--

Maybe I should remove the priorities. They're just slowing down things
and there's no real reason for them now.

Also I have in TODO:

    - send EXISTS immediately after new mail arrives.
        - linux: we can use dnotify for maildir (but not mbox I think, we'd
	  get interrupted all the time if we checked eg. large /var/spool/mail)
	- *bsd: kqueue() can notify changes in mbox and maildir

This would need some kind of API as well..




More information about the dovecot mailing list