xref: /freebsd/contrib/libevent/epolltable-internal.h (revision bdcbfde31e8e9b343f113a1956384bdf30d1ed62)
1 /*
2  * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu>
3  * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  *    derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 #ifndef EPOLLTABLE_INTERNAL_H_INCLUDED_
28 #define EPOLLTABLE_INTERNAL_H_INCLUDED_
29 
30 /*
31   Here are the values we're masking off to decide what operations to do.
32   Note that since EV_READ|EV_WRITE.
33 
34   Note also that this table is a little sparse, since ADD+DEL is
35   nonsensical ("xxx" in the list below.)
36 
37   Note also that we are shifting old_events by only 5 bits, since
38   EV_READ is 2 and EV_WRITE is 4.
39 
40   The table was auto-generated with a python script, according to this
41   pseudocode:[*0]
42 
43       If either the read or the write change is add+del:
44 	 This is impossible; Set op==-1, events=0.
45       Else, if either the read or the write change is add:
46 	 Set events to 0.
47 	 If the read change is add, or
48 	    (the read change is not del, and ev_read is in old_events):
49 	       Add EPOLLIN to events.
50 	 If the write change is add, or
51 	    (the write change is not del, and ev_write is in old_events):
52 	       Add EPOLLOUT to events.
53 
54 	 If old_events is set:
55 	       Set op to EPOLL_CTL_MOD [*1,*2]
56 	Else:
57 	       Set op to EPOLL_CTL_ADD [*3]
58 
59       Else, if the read or the write change is del:
60 	 Set op to EPOLL_CTL_DEL.
61 	 If the read change is del:
62 	     If the write change is del:
63 		 Set events to EPOLLIN|EPOLLOUT
64 	     Else if ev_write is in old_events:
65 		 Set events to EPOLLOUT
66 		Set op to EPOLL_CTL_MOD
67 	     Else
68 		 Set events to EPOLLIN
69 	 Else:
70 	     {The write change is del.}
71 	    If ev_read is in old_events:
72 		 Set events to EPOLLIN
73 		Set op to EPOLL_CTL_MOD
74 	    Else:
75 		Set the events to EPOLLOUT
76 
77       Else:
78 	   There is no read or write change; set op to 0 and events to 0.
79 
80       The logic is a little tricky, since we had no events set on the fd before,
81       we need to set op="ADD" and set events=the events we want to add.	 If we
82       had any events set on the fd before, and we want any events to remain on
83       the fd, we need to say op="MOD" and set events=the events we want to
84       remain.  But if we want to delete the last event, we say op="DEL" and
85       set events=(any non-null pointer).
86 
87   [*0] Actually, the Python script has gotten a bit more complicated, to
88        support EPOLLRDHUP.
89 
90   [*1] This MOD is only a guess.  MOD might fail with ENOENT if the file was
91        closed and a new file was opened with the same fd.  If so, we'll retry
92        with ADD.
93 
94   [*2] We can't replace this with a no-op even if old_events is the same as
95        the new events: if the file was closed and reopened, we need to retry
96        with an ADD.  (We do a MOD in this case since "no change" is more
97        common than "close and reopen", so we'll usually wind up doing 1
98        syscalls instead of 2.)
99 
100   [*3] This ADD is only a guess.  There is a fun Linux kernel issue where if
101        you have two fds for the same file (via dup) and you ADD one to an
102        epfd, then close it, then re-create it with the same fd (via dup2 or an
103        unlucky dup), then try to ADD it again, you'll get an EEXIST, since the
104        struct epitem is not actually removed from the struct eventpoll until
105        the file itself is closed.
106 
107   EV_CHANGE_ADD==1
108   EV_CHANGE_DEL==2
109   EV_READ      ==2
110   EV_WRITE     ==4
111   EV_CLOSED    ==0x80
112 
113   Bit 0: close change is add
114   Bit 1: close change is del
115   Bit 2: read change is add
116   Bit 3: read change is del
117   Bit 4: write change is add
118   Bit 5: write change is del
119   Bit 6: old events had EV_READ
120   Bit 7: old events had EV_WRITE
121   Bit 8: old events had EV_CLOSED
122 */
123 
124 #define EPOLL_OP_TABLE_INDEX(c) \
125 	(   (((c)->close_change&(EV_CHANGE_ADD|EV_CHANGE_DEL))) |		\
126 	    (((c)->read_change&(EV_CHANGE_ADD|EV_CHANGE_DEL)) << 2) |	\
127 	    (((c)->write_change&(EV_CHANGE_ADD|EV_CHANGE_DEL)) << 4) |	\
128 	    (((c)->old_events&(EV_READ|EV_WRITE)) << 5) |		\
129 	    (((c)->old_events&(EV_CLOSED)) << 1)				\
130 	    )
131 
132 #if EV_READ != 2 || EV_WRITE != 4 || EV_CLOSED != 0x80 || EV_CHANGE_ADD != 1 || EV_CHANGE_DEL != 2
133 #error "Libevent's internals changed!  Regenerate the op_table in epolltable-internal.h"
134 #endif
135 
136 static const struct operation {
137 	int events;
138 	int op;
139 } epoll_op_table[] = {
140 	/* old=  0, write:  0, read:  0, close:  0 */
141 	{ 0, 0 },
142 	/* old=  0, write:  0, read:  0, close:add */
143 	{ EPOLLRDHUP, EPOLL_CTL_ADD },
144 	/* old=  0, write:  0, read:  0, close:del */
145 	{ EPOLLRDHUP, EPOLL_CTL_DEL },
146 	/* old=  0, write:  0, read:  0, close:xxx */
147 	{ 0, 255 },
148 	/* old=  0, write:  0, read:add, close:  0 */
149 	{ EPOLLIN, EPOLL_CTL_ADD },
150 	/* old=  0, write:  0, read:add, close:add */
151 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_ADD },
152 	/* old=  0, write:  0, read:add, close:del */
153 	{ EPOLLIN, EPOLL_CTL_ADD },
154 	/* old=  0, write:  0, read:add, close:xxx */
155 	{ 0, 255 },
156 	/* old=  0, write:  0, read:del, close:  0 */
157 	{ EPOLLIN, EPOLL_CTL_DEL },
158 	/* old=  0, write:  0, read:del, close:add */
159 	{ EPOLLRDHUP, EPOLL_CTL_ADD },
160 	/* old=  0, write:  0, read:del, close:del */
161 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
162 	/* old=  0, write:  0, read:del, close:xxx */
163 	{ 0, 255 },
164 	/* old=  0, write:  0, read:xxx, close:  0 */
165 	{ 0, 255 },
166 	/* old=  0, write:  0, read:xxx, close:add */
167 	{ 0, 255 },
168 	/* old=  0, write:  0, read:xxx, close:del */
169 	{ 0, 255 },
170 	/* old=  0, write:  0, read:xxx, close:xxx */
171 	{ 0, 255 },
172 	/* old=  0, write:add, read:  0, close:  0 */
173 	{ EPOLLOUT, EPOLL_CTL_ADD },
174 	/* old=  0, write:add, read:  0, close:add */
175 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
176 	/* old=  0, write:add, read:  0, close:del */
177 	{ EPOLLOUT, EPOLL_CTL_ADD },
178 	/* old=  0, write:add, read:  0, close:xxx */
179 	{ 0, 255 },
180 	/* old=  0, write:add, read:add, close:  0 */
181 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD },
182 	/* old=  0, write:add, read:add, close:add */
183 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
184 	/* old=  0, write:add, read:add, close:del */
185 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_ADD },
186 	/* old=  0, write:add, read:add, close:xxx */
187 	{ 0, 255 },
188 	/* old=  0, write:add, read:del, close:  0 */
189 	{ EPOLLOUT, EPOLL_CTL_ADD },
190 	/* old=  0, write:add, read:del, close:add */
191 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_ADD },
192 	/* old=  0, write:add, read:del, close:del */
193 	{ EPOLLOUT, EPOLL_CTL_ADD },
194 	/* old=  0, write:add, read:del, close:xxx */
195 	{ 0, 255 },
196 	/* old=  0, write:add, read:xxx, close:  0 */
197 	{ 0, 255 },
198 	/* old=  0, write:add, read:xxx, close:add */
199 	{ 0, 255 },
200 	/* old=  0, write:add, read:xxx, close:del */
201 	{ 0, 255 },
202 	/* old=  0, write:add, read:xxx, close:xxx */
203 	{ 0, 255 },
204 	/* old=  0, write:del, read:  0, close:  0 */
205 	{ EPOLLOUT, EPOLL_CTL_DEL },
206 	/* old=  0, write:del, read:  0, close:add */
207 	{ EPOLLRDHUP, EPOLL_CTL_ADD },
208 	/* old=  0, write:del, read:  0, close:del */
209 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
210 	/* old=  0, write:del, read:  0, close:xxx */
211 	{ 0, 255 },
212 	/* old=  0, write:del, read:add, close:  0 */
213 	{ EPOLLIN, EPOLL_CTL_ADD },
214 	/* old=  0, write:del, read:add, close:add */
215 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_ADD },
216 	/* old=  0, write:del, read:add, close:del */
217 	{ EPOLLIN, EPOLL_CTL_ADD },
218 	/* old=  0, write:del, read:add, close:xxx */
219 	{ 0, 255 },
220 	/* old=  0, write:del, read:del, close:  0 */
221 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
222 	/* old=  0, write:del, read:del, close:add */
223 	{ EPOLLRDHUP, EPOLL_CTL_ADD },
224 	/* old=  0, write:del, read:del, close:del */
225 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
226 	/* old=  0, write:del, read:del, close:xxx */
227 	{ 0, 255 },
228 	/* old=  0, write:del, read:xxx, close:  0 */
229 	{ 0, 255 },
230 	/* old=  0, write:del, read:xxx, close:add */
231 	{ 0, 255 },
232 	/* old=  0, write:del, read:xxx, close:del */
233 	{ 0, 255 },
234 	/* old=  0, write:del, read:xxx, close:xxx */
235 	{ 0, 255 },
236 	/* old=  0, write:xxx, read:  0, close:  0 */
237 	{ 0, 255 },
238 	/* old=  0, write:xxx, read:  0, close:add */
239 	{ 0, 255 },
240 	/* old=  0, write:xxx, read:  0, close:del */
241 	{ 0, 255 },
242 	/* old=  0, write:xxx, read:  0, close:xxx */
243 	{ 0, 255 },
244 	/* old=  0, write:xxx, read:add, close:  0 */
245 	{ 0, 255 },
246 	/* old=  0, write:xxx, read:add, close:add */
247 	{ 0, 255 },
248 	/* old=  0, write:xxx, read:add, close:del */
249 	{ 0, 255 },
250 	/* old=  0, write:xxx, read:add, close:xxx */
251 	{ 0, 255 },
252 	/* old=  0, write:xxx, read:del, close:  0 */
253 	{ 0, 255 },
254 	/* old=  0, write:xxx, read:del, close:add */
255 	{ 0, 255 },
256 	/* old=  0, write:xxx, read:del, close:del */
257 	{ 0, 255 },
258 	/* old=  0, write:xxx, read:del, close:xxx */
259 	{ 0, 255 },
260 	/* old=  0, write:xxx, read:xxx, close:  0 */
261 	{ 0, 255 },
262 	/* old=  0, write:xxx, read:xxx, close:add */
263 	{ 0, 255 },
264 	/* old=  0, write:xxx, read:xxx, close:del */
265 	{ 0, 255 },
266 	/* old=  0, write:xxx, read:xxx, close:xxx */
267 	{ 0, 255 },
268 	/* old=  r, write:  0, read:  0, close:  0 */
269 	{ 0, 0 },
270 	/* old=  r, write:  0, read:  0, close:add */
271 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
272 	/* old=  r, write:  0, read:  0, close:del */
273 	{ EPOLLIN, EPOLL_CTL_MOD },
274 	/* old=  r, write:  0, read:  0, close:xxx */
275 	{ 0, 255 },
276 	/* old=  r, write:  0, read:add, close:  0 */
277 	{ EPOLLIN, EPOLL_CTL_MOD },
278 	/* old=  r, write:  0, read:add, close:add */
279 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
280 	/* old=  r, write:  0, read:add, close:del */
281 	{ EPOLLIN, EPOLL_CTL_MOD },
282 	/* old=  r, write:  0, read:add, close:xxx */
283 	{ 0, 255 },
284 	/* old=  r, write:  0, read:del, close:  0 */
285 	{ EPOLLIN, EPOLL_CTL_DEL },
286 	/* old=  r, write:  0, read:del, close:add */
287 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
288 	/* old=  r, write:  0, read:del, close:del */
289 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
290 	/* old=  r, write:  0, read:del, close:xxx */
291 	{ 0, 255 },
292 	/* old=  r, write:  0, read:xxx, close:  0 */
293 	{ 0, 255 },
294 	/* old=  r, write:  0, read:xxx, close:add */
295 	{ 0, 255 },
296 	/* old=  r, write:  0, read:xxx, close:del */
297 	{ 0, 255 },
298 	/* old=  r, write:  0, read:xxx, close:xxx */
299 	{ 0, 255 },
300 	/* old=  r, write:add, read:  0, close:  0 */
301 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
302 	/* old=  r, write:add, read:  0, close:add */
303 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
304 	/* old=  r, write:add, read:  0, close:del */
305 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
306 	/* old=  r, write:add, read:  0, close:xxx */
307 	{ 0, 255 },
308 	/* old=  r, write:add, read:add, close:  0 */
309 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
310 	/* old=  r, write:add, read:add, close:add */
311 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
312 	/* old=  r, write:add, read:add, close:del */
313 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
314 	/* old=  r, write:add, read:add, close:xxx */
315 	{ 0, 255 },
316 	/* old=  r, write:add, read:del, close:  0 */
317 	{ EPOLLOUT, EPOLL_CTL_MOD },
318 	/* old=  r, write:add, read:del, close:add */
319 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
320 	/* old=  r, write:add, read:del, close:del */
321 	{ EPOLLOUT, EPOLL_CTL_MOD },
322 	/* old=  r, write:add, read:del, close:xxx */
323 	{ 0, 255 },
324 	/* old=  r, write:add, read:xxx, close:  0 */
325 	{ 0, 255 },
326 	/* old=  r, write:add, read:xxx, close:add */
327 	{ 0, 255 },
328 	/* old=  r, write:add, read:xxx, close:del */
329 	{ 0, 255 },
330 	/* old=  r, write:add, read:xxx, close:xxx */
331 	{ 0, 255 },
332 	/* old=  r, write:del, read:  0, close:  0 */
333 	{ EPOLLIN, EPOLL_CTL_MOD },
334 	/* old=  r, write:del, read:  0, close:add */
335 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
336 	/* old=  r, write:del, read:  0, close:del */
337 	{ EPOLLIN, EPOLL_CTL_MOD },
338 	/* old=  r, write:del, read:  0, close:xxx */
339 	{ 0, 255 },
340 	/* old=  r, write:del, read:add, close:  0 */
341 	{ EPOLLIN, EPOLL_CTL_MOD },
342 	/* old=  r, write:del, read:add, close:add */
343 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
344 	/* old=  r, write:del, read:add, close:del */
345 	{ EPOLLIN, EPOLL_CTL_MOD },
346 	/* old=  r, write:del, read:add, close:xxx */
347 	{ 0, 255 },
348 	/* old=  r, write:del, read:del, close:  0 */
349 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
350 	/* old=  r, write:del, read:del, close:add */
351 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
352 	/* old=  r, write:del, read:del, close:del */
353 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
354 	/* old=  r, write:del, read:del, close:xxx */
355 	{ 0, 255 },
356 	/* old=  r, write:del, read:xxx, close:  0 */
357 	{ 0, 255 },
358 	/* old=  r, write:del, read:xxx, close:add */
359 	{ 0, 255 },
360 	/* old=  r, write:del, read:xxx, close:del */
361 	{ 0, 255 },
362 	/* old=  r, write:del, read:xxx, close:xxx */
363 	{ 0, 255 },
364 	/* old=  r, write:xxx, read:  0, close:  0 */
365 	{ 0, 255 },
366 	/* old=  r, write:xxx, read:  0, close:add */
367 	{ 0, 255 },
368 	/* old=  r, write:xxx, read:  0, close:del */
369 	{ 0, 255 },
370 	/* old=  r, write:xxx, read:  0, close:xxx */
371 	{ 0, 255 },
372 	/* old=  r, write:xxx, read:add, close:  0 */
373 	{ 0, 255 },
374 	/* old=  r, write:xxx, read:add, close:add */
375 	{ 0, 255 },
376 	/* old=  r, write:xxx, read:add, close:del */
377 	{ 0, 255 },
378 	/* old=  r, write:xxx, read:add, close:xxx */
379 	{ 0, 255 },
380 	/* old=  r, write:xxx, read:del, close:  0 */
381 	{ 0, 255 },
382 	/* old=  r, write:xxx, read:del, close:add */
383 	{ 0, 255 },
384 	/* old=  r, write:xxx, read:del, close:del */
385 	{ 0, 255 },
386 	/* old=  r, write:xxx, read:del, close:xxx */
387 	{ 0, 255 },
388 	/* old=  r, write:xxx, read:xxx, close:  0 */
389 	{ 0, 255 },
390 	/* old=  r, write:xxx, read:xxx, close:add */
391 	{ 0, 255 },
392 	/* old=  r, write:xxx, read:xxx, close:del */
393 	{ 0, 255 },
394 	/* old=  r, write:xxx, read:xxx, close:xxx */
395 	{ 0, 255 },
396 	/* old=  w, write:  0, read:  0, close:  0 */
397 	{ 0, 0 },
398 	/* old=  w, write:  0, read:  0, close:add */
399 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
400 	/* old=  w, write:  0, read:  0, close:del */
401 	{ EPOLLOUT, EPOLL_CTL_MOD },
402 	/* old=  w, write:  0, read:  0, close:xxx */
403 	{ 0, 255 },
404 	/* old=  w, write:  0, read:add, close:  0 */
405 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
406 	/* old=  w, write:  0, read:add, close:add */
407 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
408 	/* old=  w, write:  0, read:add, close:del */
409 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
410 	/* old=  w, write:  0, read:add, close:xxx */
411 	{ 0, 255 },
412 	/* old=  w, write:  0, read:del, close:  0 */
413 	{ EPOLLOUT, EPOLL_CTL_MOD },
414 	/* old=  w, write:  0, read:del, close:add */
415 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
416 	/* old=  w, write:  0, read:del, close:del */
417 	{ EPOLLOUT, EPOLL_CTL_MOD },
418 	/* old=  w, write:  0, read:del, close:xxx */
419 	{ 0, 255 },
420 	/* old=  w, write:  0, read:xxx, close:  0 */
421 	{ 0, 255 },
422 	/* old=  w, write:  0, read:xxx, close:add */
423 	{ 0, 255 },
424 	/* old=  w, write:  0, read:xxx, close:del */
425 	{ 0, 255 },
426 	/* old=  w, write:  0, read:xxx, close:xxx */
427 	{ 0, 255 },
428 	/* old=  w, write:add, read:  0, close:  0 */
429 	{ EPOLLOUT, EPOLL_CTL_MOD },
430 	/* old=  w, write:add, read:  0, close:add */
431 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
432 	/* old=  w, write:add, read:  0, close:del */
433 	{ EPOLLOUT, EPOLL_CTL_MOD },
434 	/* old=  w, write:add, read:  0, close:xxx */
435 	{ 0, 255 },
436 	/* old=  w, write:add, read:add, close:  0 */
437 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
438 	/* old=  w, write:add, read:add, close:add */
439 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
440 	/* old=  w, write:add, read:add, close:del */
441 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
442 	/* old=  w, write:add, read:add, close:xxx */
443 	{ 0, 255 },
444 	/* old=  w, write:add, read:del, close:  0 */
445 	{ EPOLLOUT, EPOLL_CTL_MOD },
446 	/* old=  w, write:add, read:del, close:add */
447 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
448 	/* old=  w, write:add, read:del, close:del */
449 	{ EPOLLOUT, EPOLL_CTL_MOD },
450 	/* old=  w, write:add, read:del, close:xxx */
451 	{ 0, 255 },
452 	/* old=  w, write:add, read:xxx, close:  0 */
453 	{ 0, 255 },
454 	/* old=  w, write:add, read:xxx, close:add */
455 	{ 0, 255 },
456 	/* old=  w, write:add, read:xxx, close:del */
457 	{ 0, 255 },
458 	/* old=  w, write:add, read:xxx, close:xxx */
459 	{ 0, 255 },
460 	/* old=  w, write:del, read:  0, close:  0 */
461 	{ EPOLLOUT, EPOLL_CTL_DEL },
462 	/* old=  w, write:del, read:  0, close:add */
463 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
464 	/* old=  w, write:del, read:  0, close:del */
465 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
466 	/* old=  w, write:del, read:  0, close:xxx */
467 	{ 0, 255 },
468 	/* old=  w, write:del, read:add, close:  0 */
469 	{ EPOLLIN, EPOLL_CTL_MOD },
470 	/* old=  w, write:del, read:add, close:add */
471 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
472 	/* old=  w, write:del, read:add, close:del */
473 	{ EPOLLIN, EPOLL_CTL_MOD },
474 	/* old=  w, write:del, read:add, close:xxx */
475 	{ 0, 255 },
476 	/* old=  w, write:del, read:del, close:  0 */
477 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
478 	/* old=  w, write:del, read:del, close:add */
479 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
480 	/* old=  w, write:del, read:del, close:del */
481 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
482 	/* old=  w, write:del, read:del, close:xxx */
483 	{ 0, 255 },
484 	/* old=  w, write:del, read:xxx, close:  0 */
485 	{ 0, 255 },
486 	/* old=  w, write:del, read:xxx, close:add */
487 	{ 0, 255 },
488 	/* old=  w, write:del, read:xxx, close:del */
489 	{ 0, 255 },
490 	/* old=  w, write:del, read:xxx, close:xxx */
491 	{ 0, 255 },
492 	/* old=  w, write:xxx, read:  0, close:  0 */
493 	{ 0, 255 },
494 	/* old=  w, write:xxx, read:  0, close:add */
495 	{ 0, 255 },
496 	/* old=  w, write:xxx, read:  0, close:del */
497 	{ 0, 255 },
498 	/* old=  w, write:xxx, read:  0, close:xxx */
499 	{ 0, 255 },
500 	/* old=  w, write:xxx, read:add, close:  0 */
501 	{ 0, 255 },
502 	/* old=  w, write:xxx, read:add, close:add */
503 	{ 0, 255 },
504 	/* old=  w, write:xxx, read:add, close:del */
505 	{ 0, 255 },
506 	/* old=  w, write:xxx, read:add, close:xxx */
507 	{ 0, 255 },
508 	/* old=  w, write:xxx, read:del, close:  0 */
509 	{ 0, 255 },
510 	/* old=  w, write:xxx, read:del, close:add */
511 	{ 0, 255 },
512 	/* old=  w, write:xxx, read:del, close:del */
513 	{ 0, 255 },
514 	/* old=  w, write:xxx, read:del, close:xxx */
515 	{ 0, 255 },
516 	/* old=  w, write:xxx, read:xxx, close:  0 */
517 	{ 0, 255 },
518 	/* old=  w, write:xxx, read:xxx, close:add */
519 	{ 0, 255 },
520 	/* old=  w, write:xxx, read:xxx, close:del */
521 	{ 0, 255 },
522 	/* old=  w, write:xxx, read:xxx, close:xxx */
523 	{ 0, 255 },
524 	/* old= rw, write:  0, read:  0, close:  0 */
525 	{ 0, 0 },
526 	/* old= rw, write:  0, read:  0, close:add */
527 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
528 	/* old= rw, write:  0, read:  0, close:del */
529 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
530 	/* old= rw, write:  0, read:  0, close:xxx */
531 	{ 0, 255 },
532 	/* old= rw, write:  0, read:add, close:  0 */
533 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
534 	/* old= rw, write:  0, read:add, close:add */
535 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
536 	/* old= rw, write:  0, read:add, close:del */
537 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
538 	/* old= rw, write:  0, read:add, close:xxx */
539 	{ 0, 255 },
540 	/* old= rw, write:  0, read:del, close:  0 */
541 	{ EPOLLOUT, EPOLL_CTL_MOD },
542 	/* old= rw, write:  0, read:del, close:add */
543 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
544 	/* old= rw, write:  0, read:del, close:del */
545 	{ EPOLLOUT, EPOLL_CTL_MOD },
546 	/* old= rw, write:  0, read:del, close:xxx */
547 	{ 0, 255 },
548 	/* old= rw, write:  0, read:xxx, close:  0 */
549 	{ 0, 255 },
550 	/* old= rw, write:  0, read:xxx, close:add */
551 	{ 0, 255 },
552 	/* old= rw, write:  0, read:xxx, close:del */
553 	{ 0, 255 },
554 	/* old= rw, write:  0, read:xxx, close:xxx */
555 	{ 0, 255 },
556 	/* old= rw, write:add, read:  0, close:  0 */
557 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
558 	/* old= rw, write:add, read:  0, close:add */
559 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
560 	/* old= rw, write:add, read:  0, close:del */
561 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
562 	/* old= rw, write:add, read:  0, close:xxx */
563 	{ 0, 255 },
564 	/* old= rw, write:add, read:add, close:  0 */
565 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
566 	/* old= rw, write:add, read:add, close:add */
567 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
568 	/* old= rw, write:add, read:add, close:del */
569 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
570 	/* old= rw, write:add, read:add, close:xxx */
571 	{ 0, 255 },
572 	/* old= rw, write:add, read:del, close:  0 */
573 	{ EPOLLOUT, EPOLL_CTL_MOD },
574 	/* old= rw, write:add, read:del, close:add */
575 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
576 	/* old= rw, write:add, read:del, close:del */
577 	{ EPOLLOUT, EPOLL_CTL_MOD },
578 	/* old= rw, write:add, read:del, close:xxx */
579 	{ 0, 255 },
580 	/* old= rw, write:add, read:xxx, close:  0 */
581 	{ 0, 255 },
582 	/* old= rw, write:add, read:xxx, close:add */
583 	{ 0, 255 },
584 	/* old= rw, write:add, read:xxx, close:del */
585 	{ 0, 255 },
586 	/* old= rw, write:add, read:xxx, close:xxx */
587 	{ 0, 255 },
588 	/* old= rw, write:del, read:  0, close:  0 */
589 	{ EPOLLIN, EPOLL_CTL_MOD },
590 	/* old= rw, write:del, read:  0, close:add */
591 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
592 	/* old= rw, write:del, read:  0, close:del */
593 	{ EPOLLIN, EPOLL_CTL_MOD },
594 	/* old= rw, write:del, read:  0, close:xxx */
595 	{ 0, 255 },
596 	/* old= rw, write:del, read:add, close:  0 */
597 	{ EPOLLIN, EPOLL_CTL_MOD },
598 	/* old= rw, write:del, read:add, close:add */
599 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
600 	/* old= rw, write:del, read:add, close:del */
601 	{ EPOLLIN, EPOLL_CTL_MOD },
602 	/* old= rw, write:del, read:add, close:xxx */
603 	{ 0, 255 },
604 	/* old= rw, write:del, read:del, close:  0 */
605 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_DEL },
606 	/* old= rw, write:del, read:del, close:add */
607 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
608 	/* old= rw, write:del, read:del, close:del */
609 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
610 	/* old= rw, write:del, read:del, close:xxx */
611 	{ 0, 255 },
612 	/* old= rw, write:del, read:xxx, close:  0 */
613 	{ 0, 255 },
614 	/* old= rw, write:del, read:xxx, close:add */
615 	{ 0, 255 },
616 	/* old= rw, write:del, read:xxx, close:del */
617 	{ 0, 255 },
618 	/* old= rw, write:del, read:xxx, close:xxx */
619 	{ 0, 255 },
620 	/* old= rw, write:xxx, read:  0, close:  0 */
621 	{ 0, 255 },
622 	/* old= rw, write:xxx, read:  0, close:add */
623 	{ 0, 255 },
624 	/* old= rw, write:xxx, read:  0, close:del */
625 	{ 0, 255 },
626 	/* old= rw, write:xxx, read:  0, close:xxx */
627 	{ 0, 255 },
628 	/* old= rw, write:xxx, read:add, close:  0 */
629 	{ 0, 255 },
630 	/* old= rw, write:xxx, read:add, close:add */
631 	{ 0, 255 },
632 	/* old= rw, write:xxx, read:add, close:del */
633 	{ 0, 255 },
634 	/* old= rw, write:xxx, read:add, close:xxx */
635 	{ 0, 255 },
636 	/* old= rw, write:xxx, read:del, close:  0 */
637 	{ 0, 255 },
638 	/* old= rw, write:xxx, read:del, close:add */
639 	{ 0, 255 },
640 	/* old= rw, write:xxx, read:del, close:del */
641 	{ 0, 255 },
642 	/* old= rw, write:xxx, read:del, close:xxx */
643 	{ 0, 255 },
644 	/* old= rw, write:xxx, read:xxx, close:  0 */
645 	{ 0, 255 },
646 	/* old= rw, write:xxx, read:xxx, close:add */
647 	{ 0, 255 },
648 	/* old= rw, write:xxx, read:xxx, close:del */
649 	{ 0, 255 },
650 	/* old= rw, write:xxx, read:xxx, close:xxx */
651 	{ 0, 255 },
652 	/* old=  c, write:  0, read:  0, close:  0 */
653 	{ 0, 0 },
654 	/* old=  c, write:  0, read:  0, close:add */
655 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
656 	/* old=  c, write:  0, read:  0, close:del */
657 	{ EPOLLRDHUP, EPOLL_CTL_DEL },
658 	/* old=  c, write:  0, read:  0, close:xxx */
659 	{ 0, 255 },
660 	/* old=  c, write:  0, read:add, close:  0 */
661 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
662 	/* old=  c, write:  0, read:add, close:add */
663 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
664 	/* old=  c, write:  0, read:add, close:del */
665 	{ EPOLLIN, EPOLL_CTL_MOD },
666 	/* old=  c, write:  0, read:add, close:xxx */
667 	{ 0, 255 },
668 	/* old=  c, write:  0, read:del, close:  0 */
669 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
670 	/* old=  c, write:  0, read:del, close:add */
671 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
672 	/* old=  c, write:  0, read:del, close:del */
673 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
674 	/* old=  c, write:  0, read:del, close:xxx */
675 	{ 0, 255 },
676 	/* old=  c, write:  0, read:xxx, close:  0 */
677 	{ 0, 255 },
678 	/* old=  c, write:  0, read:xxx, close:add */
679 	{ 0, 255 },
680 	/* old=  c, write:  0, read:xxx, close:del */
681 	{ 0, 255 },
682 	/* old=  c, write:  0, read:xxx, close:xxx */
683 	{ 0, 255 },
684 	/* old=  c, write:add, read:  0, close:  0 */
685 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
686 	/* old=  c, write:add, read:  0, close:add */
687 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
688 	/* old=  c, write:add, read:  0, close:del */
689 	{ EPOLLOUT, EPOLL_CTL_MOD },
690 	/* old=  c, write:add, read:  0, close:xxx */
691 	{ 0, 255 },
692 	/* old=  c, write:add, read:add, close:  0 */
693 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
694 	/* old=  c, write:add, read:add, close:add */
695 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
696 	/* old=  c, write:add, read:add, close:del */
697 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
698 	/* old=  c, write:add, read:add, close:xxx */
699 	{ 0, 255 },
700 	/* old=  c, write:add, read:del, close:  0 */
701 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
702 	/* old=  c, write:add, read:del, close:add */
703 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
704 	/* old=  c, write:add, read:del, close:del */
705 	{ EPOLLOUT, EPOLL_CTL_MOD },
706 	/* old=  c, write:add, read:del, close:xxx */
707 	{ 0, 255 },
708 	/* old=  c, write:add, read:xxx, close:  0 */
709 	{ 0, 255 },
710 	/* old=  c, write:add, read:xxx, close:add */
711 	{ 0, 255 },
712 	/* old=  c, write:add, read:xxx, close:del */
713 	{ 0, 255 },
714 	/* old=  c, write:add, read:xxx, close:xxx */
715 	{ 0, 255 },
716 	/* old=  c, write:del, read:  0, close:  0 */
717 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
718 	/* old=  c, write:del, read:  0, close:add */
719 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
720 	/* old=  c, write:del, read:  0, close:del */
721 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
722 	/* old=  c, write:del, read:  0, close:xxx */
723 	{ 0, 255 },
724 	/* old=  c, write:del, read:add, close:  0 */
725 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
726 	/* old=  c, write:del, read:add, close:add */
727 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
728 	/* old=  c, write:del, read:add, close:del */
729 	{ EPOLLIN, EPOLL_CTL_MOD },
730 	/* old=  c, write:del, read:add, close:xxx */
731 	{ 0, 255 },
732 	/* old=  c, write:del, read:del, close:  0 */
733 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
734 	/* old=  c, write:del, read:del, close:add */
735 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
736 	/* old=  c, write:del, read:del, close:del */
737 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
738 	/* old=  c, write:del, read:del, close:xxx */
739 	{ 0, 255 },
740 	/* old=  c, write:del, read:xxx, close:  0 */
741 	{ 0, 255 },
742 	/* old=  c, write:del, read:xxx, close:add */
743 	{ 0, 255 },
744 	/* old=  c, write:del, read:xxx, close:del */
745 	{ 0, 255 },
746 	/* old=  c, write:del, read:xxx, close:xxx */
747 	{ 0, 255 },
748 	/* old=  c, write:xxx, read:  0, close:  0 */
749 	{ 0, 255 },
750 	/* old=  c, write:xxx, read:  0, close:add */
751 	{ 0, 255 },
752 	/* old=  c, write:xxx, read:  0, close:del */
753 	{ 0, 255 },
754 	/* old=  c, write:xxx, read:  0, close:xxx */
755 	{ 0, 255 },
756 	/* old=  c, write:xxx, read:add, close:  0 */
757 	{ 0, 255 },
758 	/* old=  c, write:xxx, read:add, close:add */
759 	{ 0, 255 },
760 	/* old=  c, write:xxx, read:add, close:del */
761 	{ 0, 255 },
762 	/* old=  c, write:xxx, read:add, close:xxx */
763 	{ 0, 255 },
764 	/* old=  c, write:xxx, read:del, close:  0 */
765 	{ 0, 255 },
766 	/* old=  c, write:xxx, read:del, close:add */
767 	{ 0, 255 },
768 	/* old=  c, write:xxx, read:del, close:del */
769 	{ 0, 255 },
770 	/* old=  c, write:xxx, read:del, close:xxx */
771 	{ 0, 255 },
772 	/* old=  c, write:xxx, read:xxx, close:  0 */
773 	{ 0, 255 },
774 	/* old=  c, write:xxx, read:xxx, close:add */
775 	{ 0, 255 },
776 	/* old=  c, write:xxx, read:xxx, close:del */
777 	{ 0, 255 },
778 	/* old=  c, write:xxx, read:xxx, close:xxx */
779 	{ 0, 255 },
780 	/* old= cr, write:  0, read:  0, close:  0 */
781 	{ 0, 0 },
782 	/* old= cr, write:  0, read:  0, close:add */
783 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
784 	/* old= cr, write:  0, read:  0, close:del */
785 	{ EPOLLIN, EPOLL_CTL_MOD },
786 	/* old= cr, write:  0, read:  0, close:xxx */
787 	{ 0, 255 },
788 	/* old= cr, write:  0, read:add, close:  0 */
789 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
790 	/* old= cr, write:  0, read:add, close:add */
791 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
792 	/* old= cr, write:  0, read:add, close:del */
793 	{ EPOLLIN, EPOLL_CTL_MOD },
794 	/* old= cr, write:  0, read:add, close:xxx */
795 	{ 0, 255 },
796 	/* old= cr, write:  0, read:del, close:  0 */
797 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
798 	/* old= cr, write:  0, read:del, close:add */
799 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
800 	/* old= cr, write:  0, read:del, close:del */
801 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_DEL },
802 	/* old= cr, write:  0, read:del, close:xxx */
803 	{ 0, 255 },
804 	/* old= cr, write:  0, read:xxx, close:  0 */
805 	{ 0, 255 },
806 	/* old= cr, write:  0, read:xxx, close:add */
807 	{ 0, 255 },
808 	/* old= cr, write:  0, read:xxx, close:del */
809 	{ 0, 255 },
810 	/* old= cr, write:  0, read:xxx, close:xxx */
811 	{ 0, 255 },
812 	/* old= cr, write:add, read:  0, close:  0 */
813 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
814 	/* old= cr, write:add, read:  0, close:add */
815 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
816 	/* old= cr, write:add, read:  0, close:del */
817 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
818 	/* old= cr, write:add, read:  0, close:xxx */
819 	{ 0, 255 },
820 	/* old= cr, write:add, read:add, close:  0 */
821 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
822 	/* old= cr, write:add, read:add, close:add */
823 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
824 	/* old= cr, write:add, read:add, close:del */
825 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
826 	/* old= cr, write:add, read:add, close:xxx */
827 	{ 0, 255 },
828 	/* old= cr, write:add, read:del, close:  0 */
829 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
830 	/* old= cr, write:add, read:del, close:add */
831 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
832 	/* old= cr, write:add, read:del, close:del */
833 	{ EPOLLOUT, EPOLL_CTL_MOD },
834 	/* old= cr, write:add, read:del, close:xxx */
835 	{ 0, 255 },
836 	/* old= cr, write:add, read:xxx, close:  0 */
837 	{ 0, 255 },
838 	/* old= cr, write:add, read:xxx, close:add */
839 	{ 0, 255 },
840 	/* old= cr, write:add, read:xxx, close:del */
841 	{ 0, 255 },
842 	/* old= cr, write:add, read:xxx, close:xxx */
843 	{ 0, 255 },
844 	/* old= cr, write:del, read:  0, close:  0 */
845 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
846 	/* old= cr, write:del, read:  0, close:add */
847 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
848 	/* old= cr, write:del, read:  0, close:del */
849 	{ EPOLLIN, EPOLL_CTL_MOD },
850 	/* old= cr, write:del, read:  0, close:xxx */
851 	{ 0, 255 },
852 	/* old= cr, write:del, read:add, close:  0 */
853 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
854 	/* old= cr, write:del, read:add, close:add */
855 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
856 	/* old= cr, write:del, read:add, close:del */
857 	{ EPOLLIN, EPOLL_CTL_MOD },
858 	/* old= cr, write:del, read:add, close:xxx */
859 	{ 0, 255 },
860 	/* old= cr, write:del, read:del, close:  0 */
861 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
862 	/* old= cr, write:del, read:del, close:add */
863 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
864 	/* old= cr, write:del, read:del, close:del */
865 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
866 	/* old= cr, write:del, read:del, close:xxx */
867 	{ 0, 255 },
868 	/* old= cr, write:del, read:xxx, close:  0 */
869 	{ 0, 255 },
870 	/* old= cr, write:del, read:xxx, close:add */
871 	{ 0, 255 },
872 	/* old= cr, write:del, read:xxx, close:del */
873 	{ 0, 255 },
874 	/* old= cr, write:del, read:xxx, close:xxx */
875 	{ 0, 255 },
876 	/* old= cr, write:xxx, read:  0, close:  0 */
877 	{ 0, 255 },
878 	/* old= cr, write:xxx, read:  0, close:add */
879 	{ 0, 255 },
880 	/* old= cr, write:xxx, read:  0, close:del */
881 	{ 0, 255 },
882 	/* old= cr, write:xxx, read:  0, close:xxx */
883 	{ 0, 255 },
884 	/* old= cr, write:xxx, read:add, close:  0 */
885 	{ 0, 255 },
886 	/* old= cr, write:xxx, read:add, close:add */
887 	{ 0, 255 },
888 	/* old= cr, write:xxx, read:add, close:del */
889 	{ 0, 255 },
890 	/* old= cr, write:xxx, read:add, close:xxx */
891 	{ 0, 255 },
892 	/* old= cr, write:xxx, read:del, close:  0 */
893 	{ 0, 255 },
894 	/* old= cr, write:xxx, read:del, close:add */
895 	{ 0, 255 },
896 	/* old= cr, write:xxx, read:del, close:del */
897 	{ 0, 255 },
898 	/* old= cr, write:xxx, read:del, close:xxx */
899 	{ 0, 255 },
900 	/* old= cr, write:xxx, read:xxx, close:  0 */
901 	{ 0, 255 },
902 	/* old= cr, write:xxx, read:xxx, close:add */
903 	{ 0, 255 },
904 	/* old= cr, write:xxx, read:xxx, close:del */
905 	{ 0, 255 },
906 	/* old= cr, write:xxx, read:xxx, close:xxx */
907 	{ 0, 255 },
908 	/* old= cw, write:  0, read:  0, close:  0 */
909 	{ 0, 0 },
910 	/* old= cw, write:  0, read:  0, close:add */
911 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
912 	/* old= cw, write:  0, read:  0, close:del */
913 	{ EPOLLOUT, EPOLL_CTL_MOD },
914 	/* old= cw, write:  0, read:  0, close:xxx */
915 	{ 0, 255 },
916 	/* old= cw, write:  0, read:add, close:  0 */
917 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
918 	/* old= cw, write:  0, read:add, close:add */
919 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
920 	/* old= cw, write:  0, read:add, close:del */
921 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
922 	/* old= cw, write:  0, read:add, close:xxx */
923 	{ 0, 255 },
924 	/* old= cw, write:  0, read:del, close:  0 */
925 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
926 	/* old= cw, write:  0, read:del, close:add */
927 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
928 	/* old= cw, write:  0, read:del, close:del */
929 	{ EPOLLOUT, EPOLL_CTL_MOD },
930 	/* old= cw, write:  0, read:del, close:xxx */
931 	{ 0, 255 },
932 	/* old= cw, write:  0, read:xxx, close:  0 */
933 	{ 0, 255 },
934 	/* old= cw, write:  0, read:xxx, close:add */
935 	{ 0, 255 },
936 	/* old= cw, write:  0, read:xxx, close:del */
937 	{ 0, 255 },
938 	/* old= cw, write:  0, read:xxx, close:xxx */
939 	{ 0, 255 },
940 	/* old= cw, write:add, read:  0, close:  0 */
941 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
942 	/* old= cw, write:add, read:  0, close:add */
943 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
944 	/* old= cw, write:add, read:  0, close:del */
945 	{ EPOLLOUT, EPOLL_CTL_MOD },
946 	/* old= cw, write:add, read:  0, close:xxx */
947 	{ 0, 255 },
948 	/* old= cw, write:add, read:add, close:  0 */
949 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
950 	/* old= cw, write:add, read:add, close:add */
951 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
952 	/* old= cw, write:add, read:add, close:del */
953 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
954 	/* old= cw, write:add, read:add, close:xxx */
955 	{ 0, 255 },
956 	/* old= cw, write:add, read:del, close:  0 */
957 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
958 	/* old= cw, write:add, read:del, close:add */
959 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
960 	/* old= cw, write:add, read:del, close:del */
961 	{ EPOLLOUT, EPOLL_CTL_MOD },
962 	/* old= cw, write:add, read:del, close:xxx */
963 	{ 0, 255 },
964 	/* old= cw, write:add, read:xxx, close:  0 */
965 	{ 0, 255 },
966 	/* old= cw, write:add, read:xxx, close:add */
967 	{ 0, 255 },
968 	/* old= cw, write:add, read:xxx, close:del */
969 	{ 0, 255 },
970 	/* old= cw, write:add, read:xxx, close:xxx */
971 	{ 0, 255 },
972 	/* old= cw, write:del, read:  0, close:  0 */
973 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
974 	/* old= cw, write:del, read:  0, close:add */
975 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
976 	/* old= cw, write:del, read:  0, close:del */
977 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
978 	/* old= cw, write:del, read:  0, close:xxx */
979 	{ 0, 255 },
980 	/* old= cw, write:del, read:add, close:  0 */
981 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
982 	/* old= cw, write:del, read:add, close:add */
983 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
984 	/* old= cw, write:del, read:add, close:del */
985 	{ EPOLLIN, EPOLL_CTL_MOD },
986 	/* old= cw, write:del, read:add, close:xxx */
987 	{ 0, 255 },
988 	/* old= cw, write:del, read:del, close:  0 */
989 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
990 	/* old= cw, write:del, read:del, close:add */
991 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
992 	/* old= cw, write:del, read:del, close:del */
993 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
994 	/* old= cw, write:del, read:del, close:xxx */
995 	{ 0, 255 },
996 	/* old= cw, write:del, read:xxx, close:  0 */
997 	{ 0, 255 },
998 	/* old= cw, write:del, read:xxx, close:add */
999 	{ 0, 255 },
1000 	/* old= cw, write:del, read:xxx, close:del */
1001 	{ 0, 255 },
1002 	/* old= cw, write:del, read:xxx, close:xxx */
1003 	{ 0, 255 },
1004 	/* old= cw, write:xxx, read:  0, close:  0 */
1005 	{ 0, 255 },
1006 	/* old= cw, write:xxx, read:  0, close:add */
1007 	{ 0, 255 },
1008 	/* old= cw, write:xxx, read:  0, close:del */
1009 	{ 0, 255 },
1010 	/* old= cw, write:xxx, read:  0, close:xxx */
1011 	{ 0, 255 },
1012 	/* old= cw, write:xxx, read:add, close:  0 */
1013 	{ 0, 255 },
1014 	/* old= cw, write:xxx, read:add, close:add */
1015 	{ 0, 255 },
1016 	/* old= cw, write:xxx, read:add, close:del */
1017 	{ 0, 255 },
1018 	/* old= cw, write:xxx, read:add, close:xxx */
1019 	{ 0, 255 },
1020 	/* old= cw, write:xxx, read:del, close:  0 */
1021 	{ 0, 255 },
1022 	/* old= cw, write:xxx, read:del, close:add */
1023 	{ 0, 255 },
1024 	/* old= cw, write:xxx, read:del, close:del */
1025 	{ 0, 255 },
1026 	/* old= cw, write:xxx, read:del, close:xxx */
1027 	{ 0, 255 },
1028 	/* old= cw, write:xxx, read:xxx, close:  0 */
1029 	{ 0, 255 },
1030 	/* old= cw, write:xxx, read:xxx, close:add */
1031 	{ 0, 255 },
1032 	/* old= cw, write:xxx, read:xxx, close:del */
1033 	{ 0, 255 },
1034 	/* old= cw, write:xxx, read:xxx, close:xxx */
1035 	{ 0, 255 },
1036 	/* old=crw, write:  0, read:  0, close:  0 */
1037 	{ 0, 0 },
1038 	/* old=crw, write:  0, read:  0, close:add */
1039 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1040 	/* old=crw, write:  0, read:  0, close:del */
1041 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
1042 	/* old=crw, write:  0, read:  0, close:xxx */
1043 	{ 0, 255 },
1044 	/* old=crw, write:  0, read:add, close:  0 */
1045 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1046 	/* old=crw, write:  0, read:add, close:add */
1047 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1048 	/* old=crw, write:  0, read:add, close:del */
1049 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
1050 	/* old=crw, write:  0, read:add, close:xxx */
1051 	{ 0, 255 },
1052 	/* old=crw, write:  0, read:del, close:  0 */
1053 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1054 	/* old=crw, write:  0, read:del, close:add */
1055 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1056 	/* old=crw, write:  0, read:del, close:del */
1057 	{ EPOLLOUT, EPOLL_CTL_MOD },
1058 	/* old=crw, write:  0, read:del, close:xxx */
1059 	{ 0, 255 },
1060 	/* old=crw, write:  0, read:xxx, close:  0 */
1061 	{ 0, 255 },
1062 	/* old=crw, write:  0, read:xxx, close:add */
1063 	{ 0, 255 },
1064 	/* old=crw, write:  0, read:xxx, close:del */
1065 	{ 0, 255 },
1066 	/* old=crw, write:  0, read:xxx, close:xxx */
1067 	{ 0, 255 },
1068 	/* old=crw, write:add, read:  0, close:  0 */
1069 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1070 	/* old=crw, write:add, read:  0, close:add */
1071 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1072 	/* old=crw, write:add, read:  0, close:del */
1073 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
1074 	/* old=crw, write:add, read:  0, close:xxx */
1075 	{ 0, 255 },
1076 	/* old=crw, write:add, read:add, close:  0 */
1077 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1078 	/* old=crw, write:add, read:add, close:add */
1079 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1080 	/* old=crw, write:add, read:add, close:del */
1081 	{ EPOLLIN|EPOLLOUT, EPOLL_CTL_MOD },
1082 	/* old=crw, write:add, read:add, close:xxx */
1083 	{ 0, 255 },
1084 	/* old=crw, write:add, read:del, close:  0 */
1085 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1086 	/* old=crw, write:add, read:del, close:add */
1087 	{ EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_MOD },
1088 	/* old=crw, write:add, read:del, close:del */
1089 	{ EPOLLOUT, EPOLL_CTL_MOD },
1090 	/* old=crw, write:add, read:del, close:xxx */
1091 	{ 0, 255 },
1092 	/* old=crw, write:add, read:xxx, close:  0 */
1093 	{ 0, 255 },
1094 	/* old=crw, write:add, read:xxx, close:add */
1095 	{ 0, 255 },
1096 	/* old=crw, write:add, read:xxx, close:del */
1097 	{ 0, 255 },
1098 	/* old=crw, write:add, read:xxx, close:xxx */
1099 	{ 0, 255 },
1100 	/* old=crw, write:del, read:  0, close:  0 */
1101 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
1102 	/* old=crw, write:del, read:  0, close:add */
1103 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
1104 	/* old=crw, write:del, read:  0, close:del */
1105 	{ EPOLLIN, EPOLL_CTL_MOD },
1106 	/* old=crw, write:del, read:  0, close:xxx */
1107 	{ 0, 255 },
1108 	/* old=crw, write:del, read:add, close:  0 */
1109 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
1110 	/* old=crw, write:del, read:add, close:add */
1111 	{ EPOLLIN|EPOLLRDHUP, EPOLL_CTL_MOD },
1112 	/* old=crw, write:del, read:add, close:del */
1113 	{ EPOLLIN, EPOLL_CTL_MOD },
1114 	/* old=crw, write:del, read:add, close:xxx */
1115 	{ 0, 255 },
1116 	/* old=crw, write:del, read:del, close:  0 */
1117 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
1118 	/* old=crw, write:del, read:del, close:add */
1119 	{ EPOLLRDHUP, EPOLL_CTL_MOD },
1120 	/* old=crw, write:del, read:del, close:del */
1121 	{ EPOLLIN|EPOLLOUT|EPOLLRDHUP, EPOLL_CTL_DEL },
1122 	/* old=crw, write:del, read:del, close:xxx */
1123 	{ 0, 255 },
1124 	/* old=crw, write:del, read:xxx, close:  0 */
1125 	{ 0, 255 },
1126 	/* old=crw, write:del, read:xxx, close:add */
1127 	{ 0, 255 },
1128 	/* old=crw, write:del, read:xxx, close:del */
1129 	{ 0, 255 },
1130 	/* old=crw, write:del, read:xxx, close:xxx */
1131 	{ 0, 255 },
1132 	/* old=crw, write:xxx, read:  0, close:  0 */
1133 	{ 0, 255 },
1134 	/* old=crw, write:xxx, read:  0, close:add */
1135 	{ 0, 255 },
1136 	/* old=crw, write:xxx, read:  0, close:del */
1137 	{ 0, 255 },
1138 	/* old=crw, write:xxx, read:  0, close:xxx */
1139 	{ 0, 255 },
1140 	/* old=crw, write:xxx, read:add, close:  0 */
1141 	{ 0, 255 },
1142 	/* old=crw, write:xxx, read:add, close:add */
1143 	{ 0, 255 },
1144 	/* old=crw, write:xxx, read:add, close:del */
1145 	{ 0, 255 },
1146 	/* old=crw, write:xxx, read:add, close:xxx */
1147 	{ 0, 255 },
1148 	/* old=crw, write:xxx, read:del, close:  0 */
1149 	{ 0, 255 },
1150 	/* old=crw, write:xxx, read:del, close:add */
1151 	{ 0, 255 },
1152 	/* old=crw, write:xxx, read:del, close:del */
1153 	{ 0, 255 },
1154 	/* old=crw, write:xxx, read:del, close:xxx */
1155 	{ 0, 255 },
1156 	/* old=crw, write:xxx, read:xxx, close:  0 */
1157 	{ 0, 255 },
1158 	/* old=crw, write:xxx, read:xxx, close:add */
1159 	{ 0, 255 },
1160 	/* old=crw, write:xxx, read:xxx, close:del */
1161 	{ 0, 255 },
1162 	/* old=crw, write:xxx, read:xxx, close:xxx */
1163 	{ 0, 255 },
1164 };
1165 
1166 #endif
1167