-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
event.h
54 lines (46 loc) · 1.05 KB
/
event.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "config.h"
#include <sys/types.h>
#ifdef HAVE_KQUEUE
#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(struct timeval *);
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;