ioloop-notify-inotify.c revision 6246b93fb37890dcb2f4df9896438f3f376ab284
/* Copyright (C) 2005 Johannes Berg */
#define _GNU_SOURCE
#include "lib.h"
#ifdef IOLOOP_NOTIFY_INOTIFY
#include "fd-close-on-exec.h"
#include "ioloop-internal.h"
#include "buffer.h"
#include "network.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/inotify-syscalls.h>
struct ioloop_notify_handler_context {
int inotify_fd;
int disabled;
};
{
struct ioloop_notify_handler_context *ctx =
struct inotify_event *event;
int required_bytes;
i_fatal("ioctl(inotify_fd, FIONREAD) failed: %m");
if (required_bytes <= 0)
return FALSE;
if (ret == 0)
return FALSE;
if (ret < 0)
i_fatal("read(inotify_fd) failed: %m");
i_fatal("gettimeofday(): %m");
break;
}
}
break;
/* this might point outside the area if the loop
won't run again */
}
return TRUE;
}
static void event_callback(void *context)
{
while (event_read_next(ioloop)) ;
}
{
struct ioloop_notify_handler_context *ctx =
int watchdescriptor;
return NULL;
if (watchdescriptor < 0) {
return NULL;
}
}
return io;
}
{
struct ioloop_notify_handler_context *ctx =
return;
break;
}
}
i_error("inotify_rm_watch() failed: %m");
}
}
{
struct ioloop_notify_handler_context *ctx;
i_error("inotify_init() failed: %m");
return;
}
}
{
struct ioloop_notify_handler_context *ctx =
i_error("close(inotify descriptor) failed: %m");
}
#endif