dovecot-2.0: Improved "Inotify instance limit exceeded" error me...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Aug 11 19:09:56 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/6b22e2a8c534
changeset: 11977:6b22e2a8c534
user: Timo Sirainen <tss at iki.fi>
date: Wed Aug 11 17:09:51 2010 +0100
description:
Improved "Inotify instance limit exceeded" error message.
diffstat:
src/lib/ioloop-notify-inotify.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diffs (49 lines):
diff -r 8ad06727a77f -r 6b22e2a8c534 src/lib/ioloop-notify-inotify.c
--- a/src/lib/ioloop-notify-inotify.c Tue Aug 10 15:25:29 2010 +0100
+++ b/src/lib/ioloop-notify-inotify.c Wed Aug 11 17:09:51 2010 +0100
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
+#include <pwd.h>
#include <sys/ioctl.h>
#include <sys/inotify.h>
@@ -146,6 +147,23 @@
io_remove(&ctx->event_io);
}
+static void ioloop_inotify_user_limit_exceeded(void)
+{
+ const struct passwd *pw;
+ const char *name;
+ uid_t uid = geteuid();
+
+ pw = getpwuid(uid);
+ if (pw == NULL)
+ name = t_strdup_printf("UID %s", dec2str(uid));
+ else {
+ name = t_strdup_printf("%s (UID %s)",
+ dec2str(uid), pw->pw_name);
+ }
+ i_warning("Inotify instance limit for user %s exceeded, disabling. "
+ "Increase /proc/sys/fs/inotify/max_user_instances", name);
+}
+
static struct ioloop_notify_handler_context *io_loop_notify_handler_init(void)
{
struct ioloop *ioloop = current_ioloop;
@@ -158,11 +176,8 @@
if (ctx->inotify_fd == -1) {
if (errno != EMFILE)
i_error("inotify_init() failed: %m");
- else {
- i_warning("Inotify instance limit for user exceeded, "
- "disabling. Increase "
- "/proc/sys/fs/inotify/max_user_instances");
- }
+ else
+ ioloop_inotify_user_limit_exceeded();
ctx->disabled = TRUE;
} else {
fd_close_on_exec(ctx->inotify_fd, TRUE);
More information about the dovecot-cvs
mailing list