ioloop-notify-inotify.c revision 283ccfe110ed62e48f36e0d84e47da8cae5106be
/* 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>
struct inotify_io {
int wd;
};
struct ioloop_notify_handler_context {
int inotify_fd;
bool 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 =
struct inotify_io *io;
int watchdescriptor;
return NULL;
if (watchdescriptor < 0) {
return NULL;
}
}
return io;
}
{
struct ioloop_notify_handler_context *ctx =
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