00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef _SYS_EVENT_H_
00030 #define _SYS_EVENT_H_
00031
00032 #define EVFILT_READ (-1)
00033 #define EVFILT_WRITE (-2)
00034 #define EVFILT_AIO (-3)
00035 #define EVFILT_VNODE (-4)
00036 #define EVFILT_PROC (-5)
00037 #define EVFILT_SIGNAL (-6)
00038 #define EVFILT_TIMER (-7)
00039 #define EVFILT_NETDEV (-8)
00040 #define EVFILT_FS (-9)
00041
00042 #define EVFILT_SYSCOUNT 9
00043
00044 #define EV_SET(kevp_, a, b, c, d, e, f) do { \
00045 struct kevent *kevp = (kevp_); \
00046 (kevp)->ident = (a); \
00047 (kevp)->filter = (b); \
00048 (kevp)->flags = (c); \
00049 (kevp)->fflags = (d); \
00050 (kevp)->data = (e); \
00051 (kevp)->udata = (f); \
00052 } while(0)
00053
00054 struct kevent {
00055 uintptr_t ident;
00056 short filter;
00057 u_short flags;
00058 u_int fflags;
00059 intptr_t data;
00060 void *udata;
00061 };
00062
00063
00064 #define EV_ADD 0x0001
00065 #define EV_DELETE 0x0002
00066 #define EV_ENABLE 0x0004
00067 #define EV_DISABLE 0x0008
00068
00069
00070 #define EV_ONESHOT 0x0010
00071 #define EV_CLEAR 0x0020
00072
00073 #define EV_SYSFLAGS 0xF000
00074 #define EV_FLAG1 0x2000
00075
00076
00077 #define EV_EOF 0x8000
00078 #define EV_ERROR 0x4000
00079
00080
00081
00082
00083 #define NOTE_LOWAT 0x0001
00084
00085
00086
00087
00088 #define NOTE_DELETE 0x0001
00089 #define NOTE_WRITE 0x0002
00090 #define NOTE_EXTEND 0x0004
00091 #define NOTE_ATTRIB 0x0008
00092 #define NOTE_LINK 0x0010
00093 #define NOTE_RENAME 0x0020
00094 #define NOTE_REVOKE 0x0040
00095
00096
00097
00098
00099 #define NOTE_EXIT 0x80000000
00100 #define NOTE_FORK 0x40000000
00101 #define NOTE_EXEC 0x20000000
00102 #define NOTE_PCTRLMASK 0xf0000000
00103 #define NOTE_PDATAMASK 0x000fffff
00104
00105
00106 #define NOTE_TRACK 0x00000001
00107 #define NOTE_TRACKERR 0x00000002
00108 #define NOTE_CHILD 0x00000004
00109
00110
00111
00112
00113 #define NOTE_LINKUP 0x0001
00114 #define NOTE_LINKDOWN 0x0002
00115 #define NOTE_LINKINV 0x0004
00116
00117
00118
00119
00120
00121 #include <sys/queue.h>
00122 #include <sys/_lock.h>
00123 #include <sys/_mutex.h>
00124 struct knote;
00125 struct kqueue;
00126 struct knlist {
00127 struct klist kl_list;
00128 void (*kl_lock)(void *);
00129 void (*kl_unlock)(void *);
00130 int (*kl_locked)(void *);
00131 void *kl_lockarg;
00132 };
00133
00134
00135 #ifdef _KERNEL
00136
00137 #define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list)
00138
00139
00140
00141
00142
00143 #define NOTE_SIGNAL 0x08000000
00144
00145 struct filterops {
00146 int f_isfd;
00147 int (*f_attach)(struct knote *kn);
00148 void (*f_detach)(struct knote *kn);
00149 int (*f_event)(struct knote *kn, long hint);
00150 };
00151
00152
00153
00154
00155
00156
00157
00158 struct knote {
00159 SLIST_ENTRY(knote) kn_link;
00160 SLIST_ENTRY(knote) kn_selnext;
00161 struct knlist *kn_knlist;
00162 TAILQ_ENTRY(knote) kn_tqe;
00163 struct kqueue *kn_kq;
00164 struct kevent kn_kevent;
00165 int kn_status;
00166 #define KN_ACTIVE 0x01
00167 #define KN_QUEUED 0x02
00168 #define KN_DISABLED 0x04
00169 #define KN_DETACHED 0x08
00170 #define KN_INFLUX 0x10
00171 #define KN_MARKER 0x20
00172 #define KN_KQUEUE 0x40
00173 #define KN_HASKQLOCK 0x80
00174 int kn_sfflags;
00175 intptr_t kn_sdata;
00176 union {
00177 struct file *p_fp;
00178 struct proc *p_proc;
00179 } kn_ptr;
00180 struct filterops *kn_fop;
00181 void *kn_hook;
00182
00183 #define kn_id kn_kevent.ident
00184 #define kn_filter kn_kevent.filter
00185 #define kn_flags kn_kevent.flags
00186 #define kn_fflags kn_kevent.fflags
00187 #define kn_data kn_kevent.data
00188 #define kn_fp kn_ptr.p_fp
00189 };
00190 struct kevent_copyops {
00191 void *arg;
00192 int (*k_copyout)(void *arg, struct kevent *kevp, int count);
00193 int (*k_copyin)(void *arg, struct kevent *kevp, int count);
00194 };
00195
00196 struct thread;
00197 struct proc;
00198 struct knlist;
00199
00200 #endif
00201
00202 #endif