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