32 #include <sys/queue.h> 34 #define EVFILT_READ (-1) 35 #define EVFILT_WRITE (-2) 36 #define EVFILT_AIO (-3) 37 #define EVFILT_VNODE (-4) 38 #define EVFILT_PROC (-5) 39 #define EVFILT_SIGNAL (-6) 40 #define EVFILT_TIMER (-7) 42 #define EVFILT_FS (-9) 43 #define EVFILT_LIO (-10) 44 #define EVFILT_USER (-11) 45 #define EVFILT_SYSCOUNT 11 47 #define EV_SET(kevp_, a, b, c, d, e, f) do { \ 48 struct kevent *kevp = (kevp_); \ 49 (kevp)->ident = (a); \ 50 (kevp)->filter = (b); \ 51 (kevp)->flags = (c); \ 52 (kevp)->fflags = (d); \ 54 (kevp)->udata = (f); \ 68 #define EV_DELETE 0x0002 69 #define EV_ENABLE 0x0004 70 #define EV_DISABLE 0x0008 73 #define EV_ONESHOT 0x0010 74 #define EV_CLEAR 0x0020 75 #define EV_RECEIPT 0x0040 76 #define EV_DISPATCH 0x0080 78 #define EV_SYSFLAGS 0xF000 79 #define EV_DROP 0x1000 80 #define EV_FLAG1 0x2000 84 #define EV_ERROR 0x4000 95 #define NOTE_FFNOP 0x00000000 96 #define NOTE_FFAND 0x40000000 97 #define NOTE_FFOR 0x80000000 98 #define NOTE_FFCOPY 0xc0000000 99 #define NOTE_FFCTRLMASK 0xc0000000 100 #define NOTE_FFLAGSMASK 0x00ffffff 102 #define NOTE_TRIGGER 0x01000000 108 #define NOTE_LOWAT 0x0001 113 #define NOTE_DELETE 0x0001 114 #define NOTE_WRITE 0x0002 115 #define NOTE_EXTEND 0x0004 116 #define NOTE_ATTRIB 0x0008 117 #define NOTE_LINK 0x0010 118 #define NOTE_RENAME 0x0020 119 #define NOTE_REVOKE 0x0040 124 #define NOTE_EXIT 0x80000000 125 #define NOTE_FORK 0x40000000 126 #define NOTE_EXEC 0x20000000 127 #define NOTE_PCTRLMASK 0xf0000000 128 #define NOTE_PDATAMASK 0x000fffff 131 #define NOTE_TRACK 0x00000001 132 #define NOTE_TRACKERR 0x00000002 133 #define NOTE_CHILD 0x00000004 136 SLIST_HEAD(klist, knote);
138 TAILQ_HEAD(kqlist, kqueue);
140 struct klist kl_list;
141 void (*kl_lock)(
void *);
142 void (*kl_unlock)(
void *);
143 void (*kl_assert_locked)(
void *);
144 void (*kl_assert_unlocked)(
void *);
151 #ifdef MALLOC_DECLARE 152 MALLOC_DECLARE(M_KQUEUE);
158 #define KNF_LISTLOCKED 0x0001 159 #define KNF_NOKQLOCK 0x0002 161 #define KNOTE(list, hist, flags) knote(list, hist, flags) 162 #define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) 163 #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) 165 #define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list) 171 #define NOTE_SIGNAL 0x08000000 180 #define EVENT_REGISTER 1 181 #define EVENT_PROCESS 2 185 int (*f_attach)(
struct knote *kn);
186 void (*f_detach)(
struct knote *kn);
187 int (*f_event)(
struct knote *kn,
long hint);
188 void (*f_touch)(
struct knote *kn,
struct kevent *kev, u_long type);
198 SLIST_ENTRY(knote) kn_link;
199 SLIST_ENTRY(knote) kn_selnext;
201 TAILQ_ENTRY(knote) kn_tqe;
202 struct kqueue *kn_kq;
205 #define KN_ACTIVE 0x01 206 #define KN_QUEUED 0x02 207 #define KN_DISABLED 0x04 208 #define KN_DETACHED 0x08 209 #define KN_INFLUX 0x10 210 #define KN_MARKER 0x20 211 #define KN_KQUEUE 0x40 212 #define KN_HASKQLOCK 0x80 213 #define KN_SCAN 0x100 219 struct aiocblist *p_aio;
220 struct aioliojob *p_lio;
222 struct filterops *kn_fop;
226 #define kn_id kn_kevent.ident 227 #define kn_filter kn_kevent.filter 228 #define kn_flags kn_kevent.flags 229 #define kn_fflags kn_kevent.fflags 230 #define kn_data kn_kevent.data 231 #define kn_fp kn_ptr.p_fp 233 struct kevent_copyops {
235 int (*k_copyout)(
void *arg,
struct kevent *kevp,
int count);
236 int (*k_copyin)(
void *arg,
struct kevent *kevp,
int count);
244 extern void knote(
struct knlist *list,
long hint,
int lockflags);
245 extern void knote_fork(
struct knlist *list,
int pid);
246 extern void knlist_add(
struct knlist *knl,
struct knote *kn,
int islocked);
247 extern void knlist_remove(
struct knlist *knl,
struct knote *kn,
int islocked);
248 extern void knlist_remove_inevent(
struct knlist *knl,
struct knote *kn);
249 extern int knlist_empty(
struct knlist *knl);
250 extern void knlist_init(
struct knlist *knl,
void *lock,
251 void (*kl_lock)(
void *),
void (*kl_unlock)(
void *),
252 void (*kl_assert_locked)(
void *),
void (*kl_assert_unlocked)(
void *));
253 extern void knlist_init_mtx(
struct knlist *knl,
struct mtx *lock);
254 extern void knlist_destroy(
struct knlist *knl);
255 extern void knlist_cleardel(
struct knlist *knl,
struct thread *td,
256 int islocked,
int killkn);
257 #define knlist_clear(knl, islocked) \ 258 knlist_cleardel((knl), NULL, (islocked), 0) 259 #define knlist_delete(knl, td, islocked) \ 260 knlist_cleardel((knl), (td), (islocked), 1) 261 extern void knote_fdclose(
struct thread *p,
int fd);
262 extern int kqfd_register(
int fd,
struct kevent *kev,
struct thread *p,
264 extern int kqueue_add_filteropts(
int filt,
struct filterops *filtops);
265 extern int kqueue_del_filteropts(
int filt);
269 #include <sys/cdefs.h> 274 int kevent(
int kq,
const struct kevent *changelist,
int nchanges,
275 struct kevent *eventlist,
int nevents,
276 const struct timespec *timeout);
Definition: mongoose.c:439