mailbox-watch.c revision 5f1d689131a75c39f064cbd4202373e7edf78f18
/* Copyright (c) 2002-2017 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "ioloop.h"
#include "mail-storage-private.h"
#include "mailbox-watch.h"
#include <unistd.h>
#include <fcntl.h>
#define NOTIFY_DELAY_MSECS 500
struct mailbox_notify_file {
struct mailbox_notify_file *next;
char *path;
};
{
}
{
struct mailbox_notify_file *file;
}
}
if (notify)
}
{
}
}
{
struct mailbox_notify_file *file;
/* we still add a timeout if we don't have one already,
* because we don't know what happens with [di]notify
* when the filesystem is remote (NFS, ...) */
}
}
{
struct mailbox_notify_file *file;
}
}
{
i_unreached();
}
{
struct mailbox_notify_file *file;
int ret;
/* add all the notify IOs to a new ioloop. */
ioloop = io_loop_create();
case IO_NOTIFY_ADDED:
break;
case IO_NOTIFY_NOTFOUND:
break;
case IO_NOTIFY_NOSUPPORT:
*reason_r = "Filesystem notifications not supported";
break;
}
}
if (failed)
ret = -1;
else if (array_count(&temp_ios) == 0) {
*reason_r = "Mailbox has no IO notifications";
ret = -1;
} else {
if (ret == -1)
*reason_r = "Couldn't extra notify fd";
}
}
return ret;
}