/* 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;
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) {
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) {
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 |
return IO_NOTIFY_NOTFOUND;
ctx->disabled = TRUE;
- return IO_NOTIFY_DISABLED;
+ return IO_NOTIFY_NOSUPPORT;
}
if (ctx->event_io == NULL) {
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) {
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,
};
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);