]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Renamed IO_NOTIFY_DISABLED to IO_NOTIFY_NOSUPPORT. IO_NOTIFY_NOSUPPORT is
authorTimo Sirainen <tss@iki.fi>
Thu, 24 Apr 2008 13:59:19 +0000 (16:59 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 24 Apr 2008 13:59:19 +0000 (16:59 +0300)
now also given by dnotify when trying to listen for files. Fixes busy
looping with dnotify when waiting for dotlock to get deleted.

--HG--
branch : HEAD

src/lib/file-dotlock.c
src/lib/ioloop-notify-dn.c
src/lib/ioloop-notify-inotify.c
src/lib/ioloop-notify-kqueue.c
src/lib/ioloop-notify-none.c
src/lib/ioloop.h

index abaa4b717e87ecb1aeb67da1621a060bfdebbaa3..52d3b6fb8ed30893fea4d7780049829bfa9082ee 100644 (file)
@@ -429,7 +429,7 @@ static void dotlock_wait(struct lock_info *lock_info)
                /* 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;
index 947996e424bde4973e369da7fb455569c7ae2a9d..d772dc75e1b0155fff582e5dcaf504f4d87ede01 100644 (file)
@@ -84,7 +84,7 @@ enum io_notify_result io_add_notify(const char *path, io_callback_t *callback,
        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(const char *path, io_callback_t *callback,
                        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) {
index e1e13f7d1326c14630de2d72e9e2646ad9bbb411..4f299367909d1d3a15622dab70b4d4300a61d7f8 100644 (file)
@@ -95,7 +95,7 @@ enum io_notify_result io_add_notify(const char *path, io_callback_t *callback,
        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(const char *path, io_callback_t *callback,
                        return IO_NOTIFY_NOTFOUND;
 
                ctx->disabled = TRUE;
-               return IO_NOTIFY_DISABLED;
+               return IO_NOTIFY_NOSUPPORT;
        }
 
        if (ctx->event_io == NULL) {
index d3f1542646aeea41e04e643a3b18c84e7ff25d6c..ea34eb4bb3341e32d4b6247da5ced0dc7f372fa9 100644 (file)
@@ -140,7 +140,7 @@ enum io_notify_result io_add_notify(const char *path, io_callback_t *callback,
                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) {
index ebf9b812ad61d4e929bda1804f8325b45150a4ae..4cef6eaf450afc6ac5537328e386210194d9a1b2 100644 (file)
@@ -12,7 +12,7 @@ io_add_notify(const char *path ATTR_UNUSED,
              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,
index 9a9b3d3b59d466fa65834615b393beaeb790978f..67242c87f25e00099ce550f0a880bdd0e8136d12 100644 (file)
@@ -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);