Some effort was made to unify monitoring via kqueue and via inotify APIs. Now both provide their implementation of add_watch() function. I guess there are some logical bugs in vnode_process(). With this commit it would be better provide code as is, and resolve bugs separately.
55 lines
1.0 KiB
C
55 lines
1.0 KiB
C
#include "config.h"
|
|
|
|
#ifdef HAVE_KQUEUE
|
|
#include <sys/types.h>
|
|
#include <sys/event.h>
|
|
#endif
|
|
|
|
struct event;
|
|
|
|
typedef enum {
|
|
#ifdef HAVE_KQUEUE
|
|
EVENT_READ = EVFILT_READ,
|
|
EVENT_WRITE = EVFILT_WRITE,
|
|
EVENT_VNODE = EVFILT_VNODE,
|
|
#else
|
|
EVENT_READ,
|
|
EVENT_WRITE,
|
|
#endif
|
|
} event_t;
|
|
|
|
#define EV_FLAG_CLOSING 0x00000001
|
|
|
|
typedef void event_process_t(struct event *);
|
|
#ifdef HAVE_KQUEUE
|
|
typedef void event_vnode_process_t(struct event *, u_int);
|
|
#endif
|
|
|
|
struct event {
|
|
int fd;
|
|
int index;
|
|
event_t rdwr;
|
|
union {
|
|
event_process_t *process;
|
|
#ifdef HAVE_KQUEUE
|
|
event_vnode_process_t *process_vnode;
|
|
#endif
|
|
};
|
|
void *data;
|
|
};
|
|
|
|
typedef int event_module_add_t(struct event *);
|
|
typedef int event_module_del_t(struct event *, int flags);
|
|
typedef int event_module_init_t(void);
|
|
typedef void event_module_fini_t(void);
|
|
typedef int event_module_process_t(u_long);
|
|
struct event_module {
|
|
event_module_add_t *add;
|
|
event_module_del_t *del;
|
|
event_module_process_t *process;
|
|
event_module_init_t *init;
|
|
event_module_fini_t *fini;
|
|
};
|
|
|
|
extern struct event_module event_module;
|