dovecot-1.1: Renamed IO_NOTIFY_DISABLED to IO_NOTIFY_NOSUPPORT. ...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Apr 24 16:59:23 EEST 2008
details: http://hg.dovecot.org/dovecot-1.1/rev/940641318f12
changeset: 7457:940641318f12
user: Timo Sirainen <tss at iki.fi>
date: Thu Apr 24 16:59:19 2008 +0300
description:
Renamed IO_NOTIFY_DISABLED to IO_NOTIFY_NOSUPPORT. IO_NOTIFY_NOSUPPORT is
now also given by dnotify when trying to listen for files. Fixes busy
looping with dnotify when waiting for dotlock to get deleted.
diffstat:
6 files changed, 13 insertions(+), 11 deletions(-)
src/lib/file-dotlock.c | 2 +-
src/lib/ioloop-notify-dn.c | 8 +++-----
src/lib/ioloop-notify-inotify.c | 4 ++--
src/lib/ioloop-notify-kqueue.c | 2 +-
src/lib/ioloop-notify-none.c | 2 +-
src/lib/ioloop.h | 6 +++++-
diffs (114 lines):
diff -r 8af71985e97b -r 940641318f12 src/lib/file-dotlock.c
--- a/src/lib/file-dotlock.c Thu Apr 24 16:56:10 2008 +0300
+++ b/src/lib/file-dotlock.c Thu Apr 24 16:59:19 2008 +0300
@@ -429,7 +429,7 @@ static void dotlock_wait(struct lock_inf
/* the lock file doesn't exist anymore, don't sleep */
io_loop_destroy(&ioloop);
return;
- case IO_NOTIFY_DISABLED:
+ case IO_NOTIFY_NOSUPPORT:
/* listening for files not supported */
io_loop_destroy(&ioloop);
lock_info->use_io_notify = FALSE;
diff -r 8af71985e97b -r 940641318f12 src/lib/ioloop-notify-dn.c
--- a/src/lib/ioloop-notify-dn.c Thu Apr 24 16:56:10 2008 +0300
+++ b/src/lib/ioloop-notify-dn.c Thu Apr 24 16:59:19 2008 +0300
@@ -84,7 +84,7 @@ enum io_notify_result io_add_notify(cons
if (ctx == NULL)
ctx = io_loop_notify_handler_init();
if (ctx->disabled)
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
fd = open(path, O_RDONLY);
if (fd == -1) {
@@ -101,24 +101,22 @@ enum io_notify_result io_add_notify(cons
i_error("fcntl(F_SETSIG) failed: %m");
ctx->disabled = TRUE;
(void)close(fd);
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
}
if (fcntl(fd, F_NOTIFY, DN_CREATE | DN_DELETE | DN_RENAME |
DN_MULTISHOT) < 0) {
if (errno == ENOTDIR) {
/* we're trying to add dnotify to a non-directory fd.
fail silently. */
- ret = IO_NOTIFY_NOTFOUND;
} else {
/* dnotify not in kernel. disable it. */
if (errno != EINVAL)
i_error("fcntl(F_NOTIFY) failed: %m");
ctx->disabled = TRUE;
- ret = IO_NOTIFY_DISABLED;
}
(void)fcntl(fd, F_SETSIG, 0);
(void)close(fd);
- return ret;
+ return IO_NOTIFY_NOSUPPORT;
}
if (ctx->event_io == NULL) {
diff -r 8af71985e97b -r 940641318f12 src/lib/ioloop-notify-inotify.c
--- a/src/lib/ioloop-notify-inotify.c Thu Apr 24 16:56:10 2008 +0300
+++ b/src/lib/ioloop-notify-inotify.c Thu Apr 24 16:59:19 2008 +0300
@@ -95,7 +95,7 @@ enum io_notify_result io_add_notify(cons
if (ctx == NULL)
ctx = io_loop_notify_handler_init();
if (ctx->disabled)
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
wd = inotify_add_watch(ctx->inotify_fd, path,
IN_CREATE | IN_DELETE | IN_DELETE_SELF |
@@ -107,7 +107,7 @@ enum io_notify_result io_add_notify(cons
return IO_NOTIFY_NOTFOUND;
ctx->disabled = TRUE;
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
}
if (ctx->event_io == NULL) {
diff -r 8af71985e97b -r 940641318f12 src/lib/ioloop-notify-kqueue.c
--- a/src/lib/ioloop-notify-kqueue.c Thu Apr 24 16:56:10 2008 +0300
+++ b/src/lib/ioloop-notify-kqueue.c Thu Apr 24 16:59:19 2008 +0300
@@ -140,7 +140,7 @@ enum io_notify_result io_add_notify(cons
i_error("kevent(%d, %s) for notify failed: %m", fd, path);
(void)close(fd);
i_free(io);
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
}
if (ctx->event_io == NULL) {
diff -r 8af71985e97b -r 940641318f12 src/lib/ioloop-notify-none.c
--- a/src/lib/ioloop-notify-none.c Thu Apr 24 16:56:10 2008 +0300
+++ b/src/lib/ioloop-notify-none.c Thu Apr 24 16:59:19 2008 +0300
@@ -12,7 +12,7 @@ io_add_notify(const char *path ATTR_UNUS
void *context ATTR_UNUSED, struct io **io_r)
{
*io_r = NULL;
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
}
void io_loop_notify_remove(struct ioloop *ioloop ATTR_UNUSED,
diff -r 8af71985e97b -r 940641318f12 src/lib/ioloop.h
--- a/src/lib/ioloop.h Thu Apr 24 16:56:10 2008 +0300
+++ b/src/lib/ioloop.h Thu Apr 24 16:59:19 2008 +0300
@@ -20,9 +20,13 @@ enum io_condition {
};
enum io_notify_result {
+ /* Notify added successfully */
IO_NOTIFY_ADDED,
+ /* Specified file doesn't exist, can't wait on it */
IO_NOTIFY_NOTFOUND,
- IO_NOTIFY_DISABLED
+ /* Can't add notify for specified file. Main reasons for this:
+ a) No notify support at all, b) Only directory notifies supported */
+ IO_NOTIFY_NOSUPPORT
};
typedef void io_callback_t(void *context);
More information about the dovecot-cvs
mailing list