ioloop-notify-inotify.c revision c3ac8097a47d68f4aff946b18f12a17deb20a472
/* Copyright (C) 2005 Johannes Berg */
#define _GNU_SOURCE
#include "lib.h"
#ifdef IOLOOP_NOTIFY_INOTIFY
#include "ioloop-internal.h"
#include "buffer.h"
#include "network.h"
#include <stdio.h>
#include <unistd.h>
#include <fcntl.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)) ;
}
enum io_condition condition,
{
struct ioloop_notify_handler_context *ctx =
struct inotify_watch_request req;
int watchdescriptor;
if ((condition & IO_FILE_NOTIFY) != 0)
return NULL;
return NULL;
/* now set up the notification request and shoot it off */
if (watchdescriptor < 0) {
i_error("ioctl(INOTIFY_WATCH) failed: %m");
return NULL;
}
}
return io;
}
{
struct ioloop_notify_handler_context *ctx =
return;
break;
}
}
i_error("ioctl(INOTIFY_IGNORE) failed: %m");
}
}
{
struct ioloop_notify_handler_context *ctx;
if (ctx->inotify_fd < 0) {
return;
}
}
{
struct ioloop_notify_handler_context *ctx =
}
#endif