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