ioloop-notify-kqueue.c revision 2cfe9983ce7a6280636ee12beccc2e865111967b
/*
* BSD kqueue() based ioloop notify handler.
*
* Copyright (c) 2005 Vaclav Haisman <v.haisman@sh.cvut.cz>
*
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#define _GNU_SOURCE
#include "lib.h"
#ifdef IOLOOP_NOTIFY_KQUEUE
#include "ioloop-internal.h"
#include "fd-close-on-exec.h"
#include <unistd.h>
#include <fcntl.h>
/* kevent.udata's type just has to be different in NetBSD than in
FreeBSD and OpenBSD.. */
#ifdef __NetBSD__
# define MY_EV_SET(a, b, c, d, e, f, g) \
#else
# define MY_EV_SET(a, b, c, d, e, f, g) \
EV_SET(a, b, c, d, e, f, g)
#endif
struct ioloop_notify_handler_context {
int kq;
};
{
int ret;
i_fatal("gettimeofday() failed: %m");
if (ret <= 0) {
return;
i_fatal("kevent(notify) failed: %m");
}
}
{
struct ioloop_notify_handler_context *ctx;
i_fatal("kqueue(notify) failed: %m");
}
{
struct ioloop_notify_handler_context *ctx =
i_error("close(kqueue notify) failed: %m");
}
{
struct ioloop_notify_handler_context *ctx =
int fd;
if (fd == -1) {
return NULL;
}
return NULL;
}
return NULL;
}
/* EV_CLEAR flag is needed because the EVFILT_VNODE filter reports
event state transitions and not the current state. With this flag,
the same event is only returned once. */
return NULL;
}
}
return io;
}
{
struct ioloop_notify_handler_context *ctx =
}
#endif