]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Removed support for dnotify.
authorTimo Sirainen <tss@iki.fi>
Wed, 19 Aug 2015 11:47:51 +0000 (14:47 +0300)
committerTimo Sirainen <tss@iki.fi>
Wed, 19 Aug 2015 11:47:51 +0000 (14:47 +0300)
Everybody should be using inotify by now.

configure.ac
doc/example-config/conf.d/10-mail.conf
src/lib/Makefile.am
src/lib/ioloop-notify-dn.c [deleted file]
src/lib/ioloop-notify-fd.c
src/master/main.c

index 3b3261478184d4d67823c8ac5ad5140235847113..570c84c5c27b71945edb1fb735ab519fc3c87a29 100644 (file)
@@ -64,7 +64,7 @@ AS_HELP_STRING([--with-ioloop=IOLOOP], [Specify the I/O loop method to use (epol
        ioloop=best)
 
 AC_ARG_WITH(notify,
-AS_HELP_STRING([--with-notify=NOTIFY], [Specify the file system notification method to use (inotify, kqueue, dnotify, none; default is detected in the above order)]),
+AS_HELP_STRING([--with-notify=NOTIFY], [Specify the file system notification method to use (inotify, kqueue, none; default is detected in the above order)]),
        notify=$withval,
        notify=)
 
@@ -602,34 +602,6 @@ if (test "$notify" = "" && test "$ioloop" = kqueue) || test "$notify" = "kqueue"
   fi
 fi
 
-if test "$notify" = "" || test "$notify" = "dnotify"; then
-  dnl * dnotify?
-  AC_CACHE_CHECK([whether we can use dnotify],i_cv_have_dnotify,[
-    AC_TRY_COMPILE([
-      #define _GNU_SOURCE
-      #include <fcntl.h>
-      #include <signal.h>
-      #include <unistd.h>
-    ], [
-      fcntl(0, F_SETSIG, SIGRTMIN);
-      fcntl(0, F_NOTIFY, DN_CREATE | DN_DELETE | DN_RENAME | DN_MULTISHOT);
-    ], [
-      i_cv_have_dnotify=yes
-    ], [
-      i_cv_have_dnotify=no
-    ])
-  ])
-  if test $i_cv_have_dnotify = yes; then
-    AC_DEFINE(IOLOOP_NOTIFY_DNOTIFY,, [Use Linux dnotify])
-    have_notify=dnotify
-    notify=dnotify
-  else
-    if test "$notify" = "dnotify"; then
-      AC_MSG_ERROR([dnotify requested but not available])
-    fi
-  fi
-fi
-
 if test "$have_notify" = "none"; then
   AC_DEFINE(IOLOOP_NOTIFY_NONE,, [No special notify support])
 fi
index 4175aef5a302c2ec605ca39c66e92b5de865eb8b..761124327a0a742a6a437c977e84763d64310921 100644 (file)
@@ -215,7 +215,7 @@ namespace inbox {
 
 # When IDLE command is running, mailbox is checked once in a while to see if
 # there are any new mails or other changes. This setting defines the minimum
-# time to wait between those checks. Dovecot can also use dnotify, inotify and
+# time to wait between those checks. Dovecot can also use inotify and
 # kqueue to find out immediately when changes occur.
 #mailbox_idle_check_interval = 30 secs
 
index beebdf6bfeee5e6db720653034334eb81f4516fd..71958611568c913b663f4d249c6099e56289d4fb 100644 (file)
@@ -81,7 +81,6 @@ liblib_la_SOURCES = \
        ioloop-iolist.c \
        ioloop-notify-none.c \
        ioloop-notify-fd.c \
-       ioloop-notify-dn.c \
        ioloop-notify-inotify.c \
        ioloop-notify-kqueue.c \
        ioloop-poll.c \
diff --git a/src/lib/ioloop-notify-dn.c b/src/lib/ioloop-notify-dn.c
deleted file mode 100644 (file)
index 5da4933..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Copyright (c) 2003-2015 Dovecot authors, see the included COPYING file */
-
-/* Logic is pretty much based on dnotify by Oskar Liljeblad. */
-
-#define _GNU_SOURCE
-#include "lib.h"
-
-#ifdef IOLOOP_NOTIFY_DNOTIFY
-
-#include "ioloop-private.h"
-#include "ioloop-notify-fd.h"
-#include "fd-set-nonblock.h"
-#include "fd-close-on-exec.h"
-
-#include <signal.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-struct ioloop_notify_handler_context {
-       struct ioloop_notify_fd_context fd_ctx;
-
-       struct io *event_io;
-       int event_pipe[2];
-
-       bool disabled;
-};
-
-static int sigrt_refcount = 0;
-
-static struct ioloop_notify_handler_context *io_loop_notify_handler_init(void);
-
-static void ioloop_dnotify_disable(struct ioloop_notify_handler_context *ctx)
-{
-       if (ctx->disabled)
-               return;
-
-       if (--sigrt_refcount == 0)
-               signal(SIGRTMIN, SIG_IGN);
-
-       if (close(ctx->event_pipe[0]) < 0)
-               i_error("close(dnotify pipe[0]) failed: %m");
-       if (close(ctx->event_pipe[1]) < 0)
-               i_error("close(dnotify pipe[1]) failed: %m");
-       ctx->disabled = TRUE;
-}
-
-static void sigrt_handler(int signo ATTR_UNUSED, siginfo_t *si,
-                         void *data ATTR_UNUSED)
-{
-       struct ioloop_notify_handler_context *ctx =
-               current_ioloop->notify_handler_context;
-       int saved_errno = errno;
-       int ret;
-
-       if (ctx->disabled)
-               return;
-
-       ret = write(ctx->event_pipe[1], &si->si_fd, sizeof(int));
-       if (ret < 0 && errno != EINTR && errno != EAGAIN) {
-               i_error("write(dnotify pipe) failed: %m");
-               ioloop_dnotify_disable(ctx);
-       }
-
-       i_assert(ret <= 0 || ret == sizeof(int));
-
-       errno = saved_errno;
-}
-
-static void dnotify_input(struct ioloop *ioloop)
-{
-       struct ioloop_notify_handler_context *ctx =
-               ioloop->notify_handler_context;
-       struct io_notify *io;
-       int fd_buf[256], i, ret;
-
-       ret = read(ctx->event_pipe[0], fd_buf, sizeof(fd_buf));
-       if (ret < 0)
-               i_fatal("read(dnotify pipe) failed: %m");
-       if ((ret % sizeof(fd_buf[0])) != 0)
-               i_fatal("read(dnotify pipe) returned %d", ret);
-       ret /= sizeof(fd_buf[0]);
-
-       if (gettimeofday(&ioloop_timeval, NULL) < 0)
-               i_fatal("gettimeofday(): %m");
-       ioloop_time = ioloop_timeval.tv_sec;
-
-       for (i = 0; i < ret; i++) {
-               io = io_notify_fd_find(&ctx->fd_ctx, fd_buf[i]);
-               if (io != NULL)
-                       io_loop_call_io(&io->io);
-       }
-}
-
-#undef io_add_notify
-enum io_notify_result io_add_notify(const char *path, io_callback_t *callback,
-                                   void *context, struct io **io_r)
-{
-       struct ioloop_notify_handler_context *ctx =
-               current_ioloop->notify_handler_context;
-       int fd;
-
-       *io_r = NULL;
-
-       if (ctx == NULL)
-               ctx = io_loop_notify_handler_init();
-       if (ctx->disabled)
-               return IO_NOTIFY_NOSUPPORT;
-
-       fd = open(path, O_RDONLY);
-       if (fd == -1) {
-               /* ESTALE could happen with NFS. Don't bother giving an error
-                  message then. */
-               if (errno != ENOENT && errno != ESTALE)
-                       i_error("open(%s) for dnotify failed: %m", path);
-               return IO_NOTIFY_NOTFOUND;
-       }
-
-       if (fcntl(fd, F_SETSIG, SIGRTMIN) < 0) {
-               /* EINVAL means there's no realtime signals and no dnotify */
-               if (errno != EINVAL)
-                       i_error("fcntl(F_SETSIG) failed: %m");
-               ioloop_dnotify_disable(ctx);
-               i_close_fd(&fd);
-               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. */
-               } else {
-                       /* dnotify not in kernel. disable it. */
-                       if (errno != EINVAL)
-                               i_error("fcntl(F_NOTIFY) failed: %m");
-                       ioloop_dnotify_disable(ctx);
-               }
-               (void)fcntl(fd, F_SETSIG, 0);
-               i_close_fd(&fd);
-               return IO_NOTIFY_NOSUPPORT;
-       }
-
-       if (ctx->event_io == NULL) {
-               ctx->event_io = io_add(ctx->event_pipe[0], IO_READ,
-                                      dnotify_input, current_ioloop);
-       }
-
-       *io_r = io_notify_fd_add(&ctx->fd_ctx, fd, callback, context);
-       return IO_NOTIFY_ADDED;
-}
-
-void io_loop_notify_remove(struct io *_io)
-{
-       struct ioloop_notify_handler_context *ctx =
-               _io->ioloop->notify_handler_context;
-       struct io_notify *io = (struct io_notify *)_io;
-
-       if (fcntl(io->fd, F_NOTIFY, 0) < 0)
-               i_error("fcntl(F_NOTIFY, 0) failed: %m");
-       if (fcntl(io->fd, F_SETSIG, 0) < 0)
-               i_error("fcntl(F_SETSIG, 0) failed: %m");
-       if (close(io->fd))
-               i_error("close(dnotify) failed: %m");
-
-       io_notify_fd_free(&ctx->fd_ctx, io);
-
-       if (ctx->fd_ctx.notifies == NULL)
-               io_remove(&ctx->event_io);
-}
-
-static struct ioloop_notify_handler_context *io_loop_notify_handler_init(void)
-{
-       struct ioloop_notify_handler_context *ctx;
-       struct sigaction act;
-
-       ctx = current_ioloop->notify_handler_context =
-               i_new(struct ioloop_notify_handler_context, 1);
-
-       if (pipe(ctx->event_pipe) < 0) {
-               ctx->disabled = TRUE;
-               i_error("dnotify: pipe() failed: %m");
-               return ctx;
-       }
-
-       fd_set_nonblock(ctx->event_pipe[0], TRUE);
-       fd_set_nonblock(ctx->event_pipe[1], TRUE);
-
-       fd_close_on_exec(ctx->event_pipe[0], TRUE);
-       fd_close_on_exec(ctx->event_pipe[1], TRUE);
-
-       if (sigrt_refcount++ == 0) {
-               /* SIGIO is sent if queue gets full. we'll just ignore it. */
-               signal(SIGIO, SIG_IGN);
-
-               act.sa_sigaction = sigrt_handler;
-               sigemptyset(&act.sa_mask);
-               act.sa_flags = SA_SIGINFO | SA_RESTART | SA_NODEFER;
-
-               if (sigaction(SIGRTMIN, &act, NULL) < 0) {
-                       if (errno == EINVAL) {
-                               /* kernel is too old to understand even RT
-                                  signals, so there's no way dnotify works */
-                               ioloop_dnotify_disable(ctx);
-                       } else {
-                               i_fatal("sigaction(SIGRTMIN) failed: %m");
-                       }
-               }
-       }
-       return ctx;
-}
-
-void io_loop_notify_handler_deinit(struct ioloop *ioloop)
-{
-       struct ioloop_notify_handler_context *ctx =
-               ioloop->notify_handler_context;
-
-       ioloop_dnotify_disable(ctx);
-       i_free(ctx);
-}
-
-#endif
index 1e2f08f0b2ed5e50235f89b0c8086592b858c832..bf245b5b23e9b666304672dfb94bc6ce9c7befcf 100644 (file)
@@ -4,7 +4,7 @@
 #include "ioloop-private.h"
 #include "ioloop-notify-fd.h"
 
-#if defined(IOLOOP_NOTIFY_DNOTIFY) || defined(IOLOOP_NOTIFY_INOTIFY)
+#if defined(IOLOOP_NOTIFY_INOTIFY)
 
 struct io *io_notify_fd_add(struct ioloop_notify_fd_context *ctx, int fd,
                            io_callback_t *callback, void *context)
index b989d1a6fc19529b75f70ba9c71a95d65eac08ac..af21c92c2743feb9a6acf0a7e6168ee2939c06df 100644 (file)
@@ -624,9 +624,6 @@ static void print_build_options(void)
 #ifdef IOLOOP_SELECT
                " ioloop=select"
 #endif
-#ifdef IOLOOP_NOTIFY_DNOTIFY
-               " notify=dnotify"
-#endif
 #ifdef IOLOOP_NOTIFY_INOTIFY
                " notify=inotify"
 #endif