• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 PyDoc_STRVAR(select_select__doc__,
6 "select($module, rlist, wlist, xlist, timeout=None, /)\n"
7 "--\n"
8 "\n"
9 "Wait until one or more file descriptors are ready for some kind of I/O.\n"
10 "\n"
11 "The first three arguments are iterables of file descriptors to be waited for:\n"
12 "rlist -- wait until ready for reading\n"
13 "wlist -- wait until ready for writing\n"
14 "xlist -- wait for an \"exceptional condition\"\n"
15 "If only one kind of condition is required, pass [] for the other lists.\n"
16 "\n"
17 "A file descriptor is either a socket or file object, or a small integer\n"
18 "gotten from a fileno() method call on one of those.\n"
19 "\n"
20 "The optional 4th argument specifies a timeout in seconds; it may be\n"
21 "a floating point number to specify fractions of seconds.  If it is absent\n"
22 "or None, the call will never time out.\n"
23 "\n"
24 "The return value is a tuple of three lists corresponding to the first three\n"
25 "arguments; each contains the subset of the corresponding file descriptors\n"
26 "that are ready.\n"
27 "\n"
28 "*** IMPORTANT NOTICE ***\n"
29 "On Windows, only sockets are supported; on Unix, all file\n"
30 "descriptors can be used.");
31 
32 #define SELECT_SELECT_METHODDEF    \
33     {"select", (PyCFunction)(void(*)(void))select_select, METH_FASTCALL, select_select__doc__},
34 
35 static PyObject *
36 select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
37                    PyObject *xlist, PyObject *timeout_obj);
38 
39 static PyObject *
select_select(PyObject * module,PyObject * const * args,Py_ssize_t nargs)40 select_select(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
41 {
42     PyObject *return_value = NULL;
43     PyObject *rlist;
44     PyObject *wlist;
45     PyObject *xlist;
46     PyObject *timeout_obj = Py_None;
47 
48     if (!_PyArg_CheckPositional("select", nargs, 3, 4)) {
49         goto exit;
50     }
51     rlist = args[0];
52     wlist = args[1];
53     xlist = args[2];
54     if (nargs < 4) {
55         goto skip_optional;
56     }
57     timeout_obj = args[3];
58 skip_optional:
59     return_value = select_select_impl(module, rlist, wlist, xlist, timeout_obj);
60 
61 exit:
62     return return_value;
63 }
64 
65 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
66 
67 PyDoc_STRVAR(select_poll_register__doc__,
68 "register($self, fd,\n"
69 "         eventmask=select.POLLIN | select.POLLPRI | select.POLLOUT, /)\n"
70 "--\n"
71 "\n"
72 "Register a file descriptor with the polling object.\n"
73 "\n"
74 "  fd\n"
75 "    either an integer, or an object with a fileno() method returning an int\n"
76 "  eventmask\n"
77 "    an optional bitmask describing the type of events to check for");
78 
79 #define SELECT_POLL_REGISTER_METHODDEF    \
80     {"register", (PyCFunction)(void(*)(void))select_poll_register, METH_FASTCALL, select_poll_register__doc__},
81 
82 static PyObject *
83 select_poll_register_impl(pollObject *self, int fd, unsigned short eventmask);
84 
85 static PyObject *
select_poll_register(pollObject * self,PyObject * const * args,Py_ssize_t nargs)86 select_poll_register(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
87 {
88     PyObject *return_value = NULL;
89     int fd;
90     unsigned short eventmask = POLLIN | POLLPRI | POLLOUT;
91 
92     if (!_PyArg_CheckPositional("register", nargs, 1, 2)) {
93         goto exit;
94     }
95     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
96         goto exit;
97     }
98     if (nargs < 2) {
99         goto skip_optional;
100     }
101     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
102         goto exit;
103     }
104 skip_optional:
105     return_value = select_poll_register_impl(self, fd, eventmask);
106 
107 exit:
108     return return_value;
109 }
110 
111 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
112 
113 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
114 
115 PyDoc_STRVAR(select_poll_modify__doc__,
116 "modify($self, fd, eventmask, /)\n"
117 "--\n"
118 "\n"
119 "Modify an already registered file descriptor.\n"
120 "\n"
121 "  fd\n"
122 "    either an integer, or an object with a fileno() method returning\n"
123 "    an int\n"
124 "  eventmask\n"
125 "    a bitmask describing the type of events to check for");
126 
127 #define SELECT_POLL_MODIFY_METHODDEF    \
128     {"modify", (PyCFunction)(void(*)(void))select_poll_modify, METH_FASTCALL, select_poll_modify__doc__},
129 
130 static PyObject *
131 select_poll_modify_impl(pollObject *self, int fd, unsigned short eventmask);
132 
133 static PyObject *
select_poll_modify(pollObject * self,PyObject * const * args,Py_ssize_t nargs)134 select_poll_modify(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
135 {
136     PyObject *return_value = NULL;
137     int fd;
138     unsigned short eventmask;
139 
140     if (!_PyArg_CheckPositional("modify", nargs, 2, 2)) {
141         goto exit;
142     }
143     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
144         goto exit;
145     }
146     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
147         goto exit;
148     }
149     return_value = select_poll_modify_impl(self, fd, eventmask);
150 
151 exit:
152     return return_value;
153 }
154 
155 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
156 
157 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
158 
159 PyDoc_STRVAR(select_poll_unregister__doc__,
160 "unregister($self, fd, /)\n"
161 "--\n"
162 "\n"
163 "Remove a file descriptor being tracked by the polling object.");
164 
165 #define SELECT_POLL_UNREGISTER_METHODDEF    \
166     {"unregister", (PyCFunction)select_poll_unregister, METH_O, select_poll_unregister__doc__},
167 
168 static PyObject *
169 select_poll_unregister_impl(pollObject *self, int fd);
170 
171 static PyObject *
select_poll_unregister(pollObject * self,PyObject * arg)172 select_poll_unregister(pollObject *self, PyObject *arg)
173 {
174     PyObject *return_value = NULL;
175     int fd;
176 
177     if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
178         goto exit;
179     }
180     return_value = select_poll_unregister_impl(self, fd);
181 
182 exit:
183     return return_value;
184 }
185 
186 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
187 
188 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
189 
190 PyDoc_STRVAR(select_poll_poll__doc__,
191 "poll($self, timeout=None, /)\n"
192 "--\n"
193 "\n"
194 "Polls the set of registered file descriptors.\n"
195 "\n"
196 "Returns a list containing any descriptors that have events or errors to\n"
197 "report, as a list of (fd, event) 2-tuples.");
198 
199 #define SELECT_POLL_POLL_METHODDEF    \
200     {"poll", (PyCFunction)(void(*)(void))select_poll_poll, METH_FASTCALL, select_poll_poll__doc__},
201 
202 static PyObject *
203 select_poll_poll_impl(pollObject *self, PyObject *timeout_obj);
204 
205 static PyObject *
select_poll_poll(pollObject * self,PyObject * const * args,Py_ssize_t nargs)206 select_poll_poll(pollObject *self, PyObject *const *args, Py_ssize_t nargs)
207 {
208     PyObject *return_value = NULL;
209     PyObject *timeout_obj = Py_None;
210 
211     if (!_PyArg_CheckPositional("poll", nargs, 0, 1)) {
212         goto exit;
213     }
214     if (nargs < 1) {
215         goto skip_optional;
216     }
217     timeout_obj = args[0];
218 skip_optional:
219     return_value = select_poll_poll_impl(self, timeout_obj);
220 
221 exit:
222     return return_value;
223 }
224 
225 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
226 
227 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
228 
229 PyDoc_STRVAR(select_devpoll_register__doc__,
230 "register($self, fd,\n"
231 "         eventmask=select.POLLIN | select.POLLPRI | select.POLLOUT, /)\n"
232 "--\n"
233 "\n"
234 "Register a file descriptor with the polling object.\n"
235 "\n"
236 "  fd\n"
237 "    either an integer, or an object with a fileno() method returning\n"
238 "    an int\n"
239 "  eventmask\n"
240 "    an optional bitmask describing the type of events to check for");
241 
242 #define SELECT_DEVPOLL_REGISTER_METHODDEF    \
243     {"register", (PyCFunction)(void(*)(void))select_devpoll_register, METH_FASTCALL, select_devpoll_register__doc__},
244 
245 static PyObject *
246 select_devpoll_register_impl(devpollObject *self, int fd,
247                              unsigned short eventmask);
248 
249 static PyObject *
select_devpoll_register(devpollObject * self,PyObject * const * args,Py_ssize_t nargs)250 select_devpoll_register(devpollObject *self, PyObject *const *args, Py_ssize_t nargs)
251 {
252     PyObject *return_value = NULL;
253     int fd;
254     unsigned short eventmask = POLLIN | POLLPRI | POLLOUT;
255 
256     if (!_PyArg_CheckPositional("register", nargs, 1, 2)) {
257         goto exit;
258     }
259     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
260         goto exit;
261     }
262     if (nargs < 2) {
263         goto skip_optional;
264     }
265     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
266         goto exit;
267     }
268 skip_optional:
269     return_value = select_devpoll_register_impl(self, fd, eventmask);
270 
271 exit:
272     return return_value;
273 }
274 
275 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
276 
277 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
278 
279 PyDoc_STRVAR(select_devpoll_modify__doc__,
280 "modify($self, fd,\n"
281 "       eventmask=select.POLLIN | select.POLLPRI | select.POLLOUT, /)\n"
282 "--\n"
283 "\n"
284 "Modify a possible already registered file descriptor.\n"
285 "\n"
286 "  fd\n"
287 "    either an integer, or an object with a fileno() method returning\n"
288 "    an int\n"
289 "  eventmask\n"
290 "    an optional bitmask describing the type of events to check for");
291 
292 #define SELECT_DEVPOLL_MODIFY_METHODDEF    \
293     {"modify", (PyCFunction)(void(*)(void))select_devpoll_modify, METH_FASTCALL, select_devpoll_modify__doc__},
294 
295 static PyObject *
296 select_devpoll_modify_impl(devpollObject *self, int fd,
297                            unsigned short eventmask);
298 
299 static PyObject *
select_devpoll_modify(devpollObject * self,PyObject * const * args,Py_ssize_t nargs)300 select_devpoll_modify(devpollObject *self, PyObject *const *args, Py_ssize_t nargs)
301 {
302     PyObject *return_value = NULL;
303     int fd;
304     unsigned short eventmask = POLLIN | POLLPRI | POLLOUT;
305 
306     if (!_PyArg_CheckPositional("modify", nargs, 1, 2)) {
307         goto exit;
308     }
309     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
310         goto exit;
311     }
312     if (nargs < 2) {
313         goto skip_optional;
314     }
315     if (!_PyLong_UnsignedShort_Converter(args[1], &eventmask)) {
316         goto exit;
317     }
318 skip_optional:
319     return_value = select_devpoll_modify_impl(self, fd, eventmask);
320 
321 exit:
322     return return_value;
323 }
324 
325 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
326 
327 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
328 
329 PyDoc_STRVAR(select_devpoll_unregister__doc__,
330 "unregister($self, fd, /)\n"
331 "--\n"
332 "\n"
333 "Remove a file descriptor being tracked by the polling object.");
334 
335 #define SELECT_DEVPOLL_UNREGISTER_METHODDEF    \
336     {"unregister", (PyCFunction)select_devpoll_unregister, METH_O, select_devpoll_unregister__doc__},
337 
338 static PyObject *
339 select_devpoll_unregister_impl(devpollObject *self, int fd);
340 
341 static PyObject *
select_devpoll_unregister(devpollObject * self,PyObject * arg)342 select_devpoll_unregister(devpollObject *self, PyObject *arg)
343 {
344     PyObject *return_value = NULL;
345     int fd;
346 
347     if (!_PyLong_FileDescriptor_Converter(arg, &fd)) {
348         goto exit;
349     }
350     return_value = select_devpoll_unregister_impl(self, fd);
351 
352 exit:
353     return return_value;
354 }
355 
356 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
357 
358 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
359 
360 PyDoc_STRVAR(select_devpoll_poll__doc__,
361 "poll($self, timeout=None, /)\n"
362 "--\n"
363 "\n"
364 "Polls the set of registered file descriptors.\n"
365 "\n"
366 "Returns a list containing any descriptors that have events or errors to\n"
367 "report, as a list of (fd, event) 2-tuples.");
368 
369 #define SELECT_DEVPOLL_POLL_METHODDEF    \
370     {"poll", (PyCFunction)(void(*)(void))select_devpoll_poll, METH_FASTCALL, select_devpoll_poll__doc__},
371 
372 static PyObject *
373 select_devpoll_poll_impl(devpollObject *self, PyObject *timeout_obj);
374 
375 static PyObject *
select_devpoll_poll(devpollObject * self,PyObject * const * args,Py_ssize_t nargs)376 select_devpoll_poll(devpollObject *self, PyObject *const *args, Py_ssize_t nargs)
377 {
378     PyObject *return_value = NULL;
379     PyObject *timeout_obj = Py_None;
380 
381     if (!_PyArg_CheckPositional("poll", nargs, 0, 1)) {
382         goto exit;
383     }
384     if (nargs < 1) {
385         goto skip_optional;
386     }
387     timeout_obj = args[0];
388 skip_optional:
389     return_value = select_devpoll_poll_impl(self, timeout_obj);
390 
391 exit:
392     return return_value;
393 }
394 
395 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
396 
397 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
398 
399 PyDoc_STRVAR(select_devpoll_close__doc__,
400 "close($self, /)\n"
401 "--\n"
402 "\n"
403 "Close the devpoll file descriptor.\n"
404 "\n"
405 "Further operations on the devpoll object will raise an exception.");
406 
407 #define SELECT_DEVPOLL_CLOSE_METHODDEF    \
408     {"close", (PyCFunction)select_devpoll_close, METH_NOARGS, select_devpoll_close__doc__},
409 
410 static PyObject *
411 select_devpoll_close_impl(devpollObject *self);
412 
413 static PyObject *
select_devpoll_close(devpollObject * self,PyObject * Py_UNUSED (ignored))414 select_devpoll_close(devpollObject *self, PyObject *Py_UNUSED(ignored))
415 {
416     return select_devpoll_close_impl(self);
417 }
418 
419 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
420 
421 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
422 
423 PyDoc_STRVAR(select_devpoll_fileno__doc__,
424 "fileno($self, /)\n"
425 "--\n"
426 "\n"
427 "Return the file descriptor.");
428 
429 #define SELECT_DEVPOLL_FILENO_METHODDEF    \
430     {"fileno", (PyCFunction)select_devpoll_fileno, METH_NOARGS, select_devpoll_fileno__doc__},
431 
432 static PyObject *
433 select_devpoll_fileno_impl(devpollObject *self);
434 
435 static PyObject *
select_devpoll_fileno(devpollObject * self,PyObject * Py_UNUSED (ignored))436 select_devpoll_fileno(devpollObject *self, PyObject *Py_UNUSED(ignored))
437 {
438     return select_devpoll_fileno_impl(self);
439 }
440 
441 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
442 
443 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL))
444 
445 PyDoc_STRVAR(select_poll__doc__,
446 "poll($module, /)\n"
447 "--\n"
448 "\n"
449 "Returns a polling object.\n"
450 "\n"
451 "This object supports registering and unregistering file descriptors, and then\n"
452 "polling them for I/O events.");
453 
454 #define SELECT_POLL_METHODDEF    \
455     {"poll", (PyCFunction)select_poll, METH_NOARGS, select_poll__doc__},
456 
457 static PyObject *
458 select_poll_impl(PyObject *module);
459 
460 static PyObject *
select_poll(PyObject * module,PyObject * Py_UNUSED (ignored))461 select_poll(PyObject *module, PyObject *Py_UNUSED(ignored))
462 {
463     return select_poll_impl(module);
464 }
465 
466 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) */
467 
468 #if (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H)
469 
470 PyDoc_STRVAR(select_devpoll__doc__,
471 "devpoll($module, /)\n"
472 "--\n"
473 "\n"
474 "Returns a polling object.\n"
475 "\n"
476 "This object supports registering and unregistering file descriptors, and then\n"
477 "polling them for I/O events.");
478 
479 #define SELECT_DEVPOLL_METHODDEF    \
480     {"devpoll", (PyCFunction)select_devpoll, METH_NOARGS, select_devpoll__doc__},
481 
482 static PyObject *
483 select_devpoll_impl(PyObject *module);
484 
485 static PyObject *
select_devpoll(PyObject * module,PyObject * Py_UNUSED (ignored))486 select_devpoll(PyObject *module, PyObject *Py_UNUSED(ignored))
487 {
488     return select_devpoll_impl(module);
489 }
490 
491 #endif /* (defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL)) && defined(HAVE_SYS_DEVPOLL_H) */
492 
493 #if defined(HAVE_EPOLL)
494 
495 PyDoc_STRVAR(select_epoll__doc__,
496 "epoll(sizehint=-1, flags=0)\n"
497 "--\n"
498 "\n"
499 "Returns an epolling object.\n"
500 "\n"
501 "  sizehint\n"
502 "    The expected number of events to be registered.  It must be positive,\n"
503 "    or -1 to use the default.  It is only used on older systems where\n"
504 "    epoll_create1() is not available; otherwise it has no effect (though its\n"
505 "    value is still checked).\n"
506 "  flags\n"
507 "    Deprecated and completely ignored.  However, when supplied, its value\n"
508 "    must be 0 or select.EPOLL_CLOEXEC, otherwise OSError is raised.");
509 
510 static PyObject *
511 select_epoll_impl(PyTypeObject *type, int sizehint, int flags);
512 
513 static PyObject *
select_epoll(PyTypeObject * type,PyObject * args,PyObject * kwargs)514 select_epoll(PyTypeObject *type, PyObject *args, PyObject *kwargs)
515 {
516     PyObject *return_value = NULL;
517     static const char * const _keywords[] = {"sizehint", "flags", NULL};
518     static _PyArg_Parser _parser = {NULL, _keywords, "epoll", 0};
519     PyObject *argsbuf[2];
520     PyObject * const *fastargs;
521     Py_ssize_t nargs = PyTuple_GET_SIZE(args);
522     Py_ssize_t noptargs = nargs + (kwargs ? PyDict_GET_SIZE(kwargs) : 0) - 0;
523     int sizehint = -1;
524     int flags = 0;
525 
526     fastargs = _PyArg_UnpackKeywords(_PyTuple_CAST(args)->ob_item, nargs, kwargs, NULL, &_parser, 0, 2, 0, argsbuf);
527     if (!fastargs) {
528         goto exit;
529     }
530     if (!noptargs) {
531         goto skip_optional_pos;
532     }
533     if (fastargs[0]) {
534         sizehint = _PyLong_AsInt(fastargs[0]);
535         if (sizehint == -1 && PyErr_Occurred()) {
536             goto exit;
537         }
538         if (!--noptargs) {
539             goto skip_optional_pos;
540         }
541     }
542     flags = _PyLong_AsInt(fastargs[1]);
543     if (flags == -1 && PyErr_Occurred()) {
544         goto exit;
545     }
546 skip_optional_pos:
547     return_value = select_epoll_impl(type, sizehint, flags);
548 
549 exit:
550     return return_value;
551 }
552 
553 #endif /* defined(HAVE_EPOLL) */
554 
555 #if defined(HAVE_EPOLL)
556 
557 PyDoc_STRVAR(select_epoll_close__doc__,
558 "close($self, /)\n"
559 "--\n"
560 "\n"
561 "Close the epoll control file descriptor.\n"
562 "\n"
563 "Further operations on the epoll object will raise an exception.");
564 
565 #define SELECT_EPOLL_CLOSE_METHODDEF    \
566     {"close", (PyCFunction)select_epoll_close, METH_NOARGS, select_epoll_close__doc__},
567 
568 static PyObject *
569 select_epoll_close_impl(pyEpoll_Object *self);
570 
571 static PyObject *
select_epoll_close(pyEpoll_Object * self,PyObject * Py_UNUSED (ignored))572 select_epoll_close(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
573 {
574     return select_epoll_close_impl(self);
575 }
576 
577 #endif /* defined(HAVE_EPOLL) */
578 
579 #if defined(HAVE_EPOLL)
580 
581 PyDoc_STRVAR(select_epoll_fileno__doc__,
582 "fileno($self, /)\n"
583 "--\n"
584 "\n"
585 "Return the epoll control file descriptor.");
586 
587 #define SELECT_EPOLL_FILENO_METHODDEF    \
588     {"fileno", (PyCFunction)select_epoll_fileno, METH_NOARGS, select_epoll_fileno__doc__},
589 
590 static PyObject *
591 select_epoll_fileno_impl(pyEpoll_Object *self);
592 
593 static PyObject *
select_epoll_fileno(pyEpoll_Object * self,PyObject * Py_UNUSED (ignored))594 select_epoll_fileno(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
595 {
596     return select_epoll_fileno_impl(self);
597 }
598 
599 #endif /* defined(HAVE_EPOLL) */
600 
601 #if defined(HAVE_EPOLL)
602 
603 PyDoc_STRVAR(select_epoll_fromfd__doc__,
604 "fromfd($type, fd, /)\n"
605 "--\n"
606 "\n"
607 "Create an epoll object from a given control fd.");
608 
609 #define SELECT_EPOLL_FROMFD_METHODDEF    \
610     {"fromfd", (PyCFunction)select_epoll_fromfd, METH_O|METH_CLASS, select_epoll_fromfd__doc__},
611 
612 static PyObject *
613 select_epoll_fromfd_impl(PyTypeObject *type, int fd);
614 
615 static PyObject *
select_epoll_fromfd(PyTypeObject * type,PyObject * arg)616 select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
617 {
618     PyObject *return_value = NULL;
619     int fd;
620 
621     fd = _PyLong_AsInt(arg);
622     if (fd == -1 && PyErr_Occurred()) {
623         goto exit;
624     }
625     return_value = select_epoll_fromfd_impl(type, fd);
626 
627 exit:
628     return return_value;
629 }
630 
631 #endif /* defined(HAVE_EPOLL) */
632 
633 #if defined(HAVE_EPOLL)
634 
635 PyDoc_STRVAR(select_epoll_register__doc__,
636 "register($self, /, fd,\n"
637 "         eventmask=select.EPOLLIN | select.EPOLLPRI | select.EPOLLOUT)\n"
638 "--\n"
639 "\n"
640 "Registers a new fd or raises an OSError if the fd is already registered.\n"
641 "\n"
642 "  fd\n"
643 "    the target file descriptor of the operation\n"
644 "  eventmask\n"
645 "    a bit set composed of the various EPOLL constants\n"
646 "\n"
647 "The epoll interface supports all file descriptors that support poll.");
648 
649 #define SELECT_EPOLL_REGISTER_METHODDEF    \
650     {"register", (PyCFunction)(void(*)(void))select_epoll_register, METH_FASTCALL|METH_KEYWORDS, select_epoll_register__doc__},
651 
652 static PyObject *
653 select_epoll_register_impl(pyEpoll_Object *self, int fd,
654                            unsigned int eventmask);
655 
656 static PyObject *
select_epoll_register(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)657 select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
658 {
659     PyObject *return_value = NULL;
660     static const char * const _keywords[] = {"fd", "eventmask", NULL};
661     static _PyArg_Parser _parser = {NULL, _keywords, "register", 0};
662     PyObject *argsbuf[2];
663     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
664     int fd;
665     unsigned int eventmask = EPOLLIN | EPOLLPRI | EPOLLOUT;
666 
667     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
668     if (!args) {
669         goto exit;
670     }
671     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
672         goto exit;
673     }
674     if (!noptargs) {
675         goto skip_optional_pos;
676     }
677     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
678     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
679         goto exit;
680     }
681 skip_optional_pos:
682     return_value = select_epoll_register_impl(self, fd, eventmask);
683 
684 exit:
685     return return_value;
686 }
687 
688 #endif /* defined(HAVE_EPOLL) */
689 
690 #if defined(HAVE_EPOLL)
691 
692 PyDoc_STRVAR(select_epoll_modify__doc__,
693 "modify($self, /, fd, eventmask)\n"
694 "--\n"
695 "\n"
696 "Modify event mask for a registered file descriptor.\n"
697 "\n"
698 "  fd\n"
699 "    the target file descriptor of the operation\n"
700 "  eventmask\n"
701 "    a bit set composed of the various EPOLL constants");
702 
703 #define SELECT_EPOLL_MODIFY_METHODDEF    \
704     {"modify", (PyCFunction)(void(*)(void))select_epoll_modify, METH_FASTCALL|METH_KEYWORDS, select_epoll_modify__doc__},
705 
706 static PyObject *
707 select_epoll_modify_impl(pyEpoll_Object *self, int fd,
708                          unsigned int eventmask);
709 
710 static PyObject *
select_epoll_modify(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)711 select_epoll_modify(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
712 {
713     PyObject *return_value = NULL;
714     static const char * const _keywords[] = {"fd", "eventmask", NULL};
715     static _PyArg_Parser _parser = {NULL, _keywords, "modify", 0};
716     PyObject *argsbuf[2];
717     int fd;
718     unsigned int eventmask;
719 
720     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
721     if (!args) {
722         goto exit;
723     }
724     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
725         goto exit;
726     }
727     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
728     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
729         goto exit;
730     }
731     return_value = select_epoll_modify_impl(self, fd, eventmask);
732 
733 exit:
734     return return_value;
735 }
736 
737 #endif /* defined(HAVE_EPOLL) */
738 
739 #if defined(HAVE_EPOLL)
740 
741 PyDoc_STRVAR(select_epoll_unregister__doc__,
742 "unregister($self, /, fd)\n"
743 "--\n"
744 "\n"
745 "Remove a registered file descriptor from the epoll object.\n"
746 "\n"
747 "  fd\n"
748 "    the target file descriptor of the operation");
749 
750 #define SELECT_EPOLL_UNREGISTER_METHODDEF    \
751     {"unregister", (PyCFunction)(void(*)(void))select_epoll_unregister, METH_FASTCALL|METH_KEYWORDS, select_epoll_unregister__doc__},
752 
753 static PyObject *
754 select_epoll_unregister_impl(pyEpoll_Object *self, int fd);
755 
756 static PyObject *
select_epoll_unregister(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)757 select_epoll_unregister(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
758 {
759     PyObject *return_value = NULL;
760     static const char * const _keywords[] = {"fd", NULL};
761     static _PyArg_Parser _parser = {NULL, _keywords, "unregister", 0};
762     PyObject *argsbuf[1];
763     int fd;
764 
765     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
766     if (!args) {
767         goto exit;
768     }
769     if (!_PyLong_FileDescriptor_Converter(args[0], &fd)) {
770         goto exit;
771     }
772     return_value = select_epoll_unregister_impl(self, fd);
773 
774 exit:
775     return return_value;
776 }
777 
778 #endif /* defined(HAVE_EPOLL) */
779 
780 #if defined(HAVE_EPOLL)
781 
782 PyDoc_STRVAR(select_epoll_poll__doc__,
783 "poll($self, /, timeout=None, maxevents=-1)\n"
784 "--\n"
785 "\n"
786 "Wait for events on the epoll file descriptor.\n"
787 "\n"
788 "  timeout\n"
789 "    the maximum time to wait in seconds (as float);\n"
790 "    a timeout of None or -1 makes poll wait indefinitely\n"
791 "  maxevents\n"
792 "    the maximum number of events returned; -1 means no limit\n"
793 "\n"
794 "Returns a list containing any descriptors that have events to report,\n"
795 "as a list of (fd, events) 2-tuples.");
796 
797 #define SELECT_EPOLL_POLL_METHODDEF    \
798     {"poll", (PyCFunction)(void(*)(void))select_epoll_poll, METH_FASTCALL|METH_KEYWORDS, select_epoll_poll__doc__},
799 
800 static PyObject *
801 select_epoll_poll_impl(pyEpoll_Object *self, PyObject *timeout_obj,
802                        int maxevents);
803 
804 static PyObject *
select_epoll_poll(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)805 select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
806 {
807     PyObject *return_value = NULL;
808     static const char * const _keywords[] = {"timeout", "maxevents", NULL};
809     static _PyArg_Parser _parser = {NULL, _keywords, "poll", 0};
810     PyObject *argsbuf[2];
811     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
812     PyObject *timeout_obj = Py_None;
813     int maxevents = -1;
814 
815     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
816     if (!args) {
817         goto exit;
818     }
819     if (!noptargs) {
820         goto skip_optional_pos;
821     }
822     if (args[0]) {
823         timeout_obj = args[0];
824         if (!--noptargs) {
825             goto skip_optional_pos;
826         }
827     }
828     maxevents = _PyLong_AsInt(args[1]);
829     if (maxevents == -1 && PyErr_Occurred()) {
830         goto exit;
831     }
832 skip_optional_pos:
833     return_value = select_epoll_poll_impl(self, timeout_obj, maxevents);
834 
835 exit:
836     return return_value;
837 }
838 
839 #endif /* defined(HAVE_EPOLL) */
840 
841 #if defined(HAVE_EPOLL)
842 
843 PyDoc_STRVAR(select_epoll___enter____doc__,
844 "__enter__($self, /)\n"
845 "--\n"
846 "\n");
847 
848 #define SELECT_EPOLL___ENTER___METHODDEF    \
849     {"__enter__", (PyCFunction)select_epoll___enter__, METH_NOARGS, select_epoll___enter____doc__},
850 
851 static PyObject *
852 select_epoll___enter___impl(pyEpoll_Object *self);
853 
854 static PyObject *
select_epoll___enter__(pyEpoll_Object * self,PyObject * Py_UNUSED (ignored))855 select_epoll___enter__(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
856 {
857     return select_epoll___enter___impl(self);
858 }
859 
860 #endif /* defined(HAVE_EPOLL) */
861 
862 #if defined(HAVE_EPOLL)
863 
864 PyDoc_STRVAR(select_epoll___exit____doc__,
865 "__exit__($self, exc_type=None, exc_value=None, exc_tb=None, /)\n"
866 "--\n"
867 "\n");
868 
869 #define SELECT_EPOLL___EXIT___METHODDEF    \
870     {"__exit__", (PyCFunction)(void(*)(void))select_epoll___exit__, METH_FASTCALL, select_epoll___exit____doc__},
871 
872 static PyObject *
873 select_epoll___exit___impl(pyEpoll_Object *self, PyObject *exc_type,
874                            PyObject *exc_value, PyObject *exc_tb);
875 
876 static PyObject *
select_epoll___exit__(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs)877 select_epoll___exit__(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs)
878 {
879     PyObject *return_value = NULL;
880     PyObject *exc_type = Py_None;
881     PyObject *exc_value = Py_None;
882     PyObject *exc_tb = Py_None;
883 
884     if (!_PyArg_CheckPositional("__exit__", nargs, 0, 3)) {
885         goto exit;
886     }
887     if (nargs < 1) {
888         goto skip_optional;
889     }
890     exc_type = args[0];
891     if (nargs < 2) {
892         goto skip_optional;
893     }
894     exc_value = args[1];
895     if (nargs < 3) {
896         goto skip_optional;
897     }
898     exc_tb = args[2];
899 skip_optional:
900     return_value = select_epoll___exit___impl(self, exc_type, exc_value, exc_tb);
901 
902 exit:
903     return return_value;
904 }
905 
906 #endif /* defined(HAVE_EPOLL) */
907 
908 #if defined(HAVE_KQUEUE)
909 
910 PyDoc_STRVAR(select_kqueue__doc__,
911 "kqueue()\n"
912 "--\n"
913 "\n"
914 "Kqueue syscall wrapper.\n"
915 "\n"
916 "For example, to start watching a socket for input:\n"
917 ">>> kq = kqueue()\n"
918 ">>> sock = socket()\n"
919 ">>> sock.connect((host, port))\n"
920 ">>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_ADD)], 0)\n"
921 "\n"
922 "To wait one second for it to become writeable:\n"
923 ">>> kq.control(None, 1, 1000)\n"
924 "\n"
925 "To stop listening:\n"
926 ">>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_DELETE)], 0)");
927 
928 static PyObject *
929 select_kqueue_impl(PyTypeObject *type);
930 
931 static PyObject *
select_kqueue(PyTypeObject * type,PyObject * args,PyObject * kwargs)932 select_kqueue(PyTypeObject *type, PyObject *args, PyObject *kwargs)
933 {
934     PyObject *return_value = NULL;
935 
936     if ((type == _selectstate_by_type(type)->kqueue_queue_Type) &&
937         !_PyArg_NoPositional("kqueue", args)) {
938         goto exit;
939     }
940     if ((type == _selectstate_by_type(type)->kqueue_queue_Type) &&
941         !_PyArg_NoKeywords("kqueue", kwargs)) {
942         goto exit;
943     }
944     return_value = select_kqueue_impl(type);
945 
946 exit:
947     return return_value;
948 }
949 
950 #endif /* defined(HAVE_KQUEUE) */
951 
952 #if defined(HAVE_KQUEUE)
953 
954 PyDoc_STRVAR(select_kqueue_close__doc__,
955 "close($self, /)\n"
956 "--\n"
957 "\n"
958 "Close the kqueue control file descriptor.\n"
959 "\n"
960 "Further operations on the kqueue object will raise an exception.");
961 
962 #define SELECT_KQUEUE_CLOSE_METHODDEF    \
963     {"close", (PyCFunction)select_kqueue_close, METH_NOARGS, select_kqueue_close__doc__},
964 
965 static PyObject *
966 select_kqueue_close_impl(kqueue_queue_Object *self);
967 
968 static PyObject *
select_kqueue_close(kqueue_queue_Object * self,PyObject * Py_UNUSED (ignored))969 select_kqueue_close(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored))
970 {
971     return select_kqueue_close_impl(self);
972 }
973 
974 #endif /* defined(HAVE_KQUEUE) */
975 
976 #if defined(HAVE_KQUEUE)
977 
978 PyDoc_STRVAR(select_kqueue_fileno__doc__,
979 "fileno($self, /)\n"
980 "--\n"
981 "\n"
982 "Return the kqueue control file descriptor.");
983 
984 #define SELECT_KQUEUE_FILENO_METHODDEF    \
985     {"fileno", (PyCFunction)select_kqueue_fileno, METH_NOARGS, select_kqueue_fileno__doc__},
986 
987 static PyObject *
988 select_kqueue_fileno_impl(kqueue_queue_Object *self);
989 
990 static PyObject *
select_kqueue_fileno(kqueue_queue_Object * self,PyObject * Py_UNUSED (ignored))991 select_kqueue_fileno(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored))
992 {
993     return select_kqueue_fileno_impl(self);
994 }
995 
996 #endif /* defined(HAVE_KQUEUE) */
997 
998 #if defined(HAVE_KQUEUE)
999 
1000 PyDoc_STRVAR(select_kqueue_fromfd__doc__,
1001 "fromfd($type, fd, /)\n"
1002 "--\n"
1003 "\n"
1004 "Create a kqueue object from a given control fd.");
1005 
1006 #define SELECT_KQUEUE_FROMFD_METHODDEF    \
1007     {"fromfd", (PyCFunction)select_kqueue_fromfd, METH_O|METH_CLASS, select_kqueue_fromfd__doc__},
1008 
1009 static PyObject *
1010 select_kqueue_fromfd_impl(PyTypeObject *type, int fd);
1011 
1012 static PyObject *
select_kqueue_fromfd(PyTypeObject * type,PyObject * arg)1013 select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
1014 {
1015     PyObject *return_value = NULL;
1016     int fd;
1017 
1018     fd = _PyLong_AsInt(arg);
1019     if (fd == -1 && PyErr_Occurred()) {
1020         goto exit;
1021     }
1022     return_value = select_kqueue_fromfd_impl(type, fd);
1023 
1024 exit:
1025     return return_value;
1026 }
1027 
1028 #endif /* defined(HAVE_KQUEUE) */
1029 
1030 #if defined(HAVE_KQUEUE)
1031 
1032 PyDoc_STRVAR(select_kqueue_control__doc__,
1033 "control($self, changelist, maxevents, timeout=None, /)\n"
1034 "--\n"
1035 "\n"
1036 "Calls the kernel kevent function.\n"
1037 "\n"
1038 "  changelist\n"
1039 "    Must be an iterable of kevent objects describing the changes to be made\n"
1040 "    to the kernel\'s watch list or None.\n"
1041 "  maxevents\n"
1042 "    The maximum number of events that the kernel will return.\n"
1043 "  timeout\n"
1044 "    The maximum time to wait in seconds, or else None to wait forever.\n"
1045 "    This accepts floats for smaller timeouts, too.");
1046 
1047 #define SELECT_KQUEUE_CONTROL_METHODDEF    \
1048     {"control", (PyCFunction)(void(*)(void))select_kqueue_control, METH_FASTCALL, select_kqueue_control__doc__},
1049 
1050 static PyObject *
1051 select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist,
1052                            int maxevents, PyObject *otimeout);
1053 
1054 static PyObject *
select_kqueue_control(kqueue_queue_Object * self,PyObject * const * args,Py_ssize_t nargs)1055 select_kqueue_control(kqueue_queue_Object *self, PyObject *const *args, Py_ssize_t nargs)
1056 {
1057     PyObject *return_value = NULL;
1058     PyObject *changelist;
1059     int maxevents;
1060     PyObject *otimeout = Py_None;
1061 
1062     if (!_PyArg_CheckPositional("control", nargs, 2, 3)) {
1063         goto exit;
1064     }
1065     changelist = args[0];
1066     maxevents = _PyLong_AsInt(args[1]);
1067     if (maxevents == -1 && PyErr_Occurred()) {
1068         goto exit;
1069     }
1070     if (nargs < 3) {
1071         goto skip_optional;
1072     }
1073     otimeout = args[2];
1074 skip_optional:
1075     return_value = select_kqueue_control_impl(self, changelist, maxevents, otimeout);
1076 
1077 exit:
1078     return return_value;
1079 }
1080 
1081 #endif /* defined(HAVE_KQUEUE) */
1082 
1083 #ifndef SELECT_POLL_REGISTER_METHODDEF
1084     #define SELECT_POLL_REGISTER_METHODDEF
1085 #endif /* !defined(SELECT_POLL_REGISTER_METHODDEF) */
1086 
1087 #ifndef SELECT_POLL_MODIFY_METHODDEF
1088     #define SELECT_POLL_MODIFY_METHODDEF
1089 #endif /* !defined(SELECT_POLL_MODIFY_METHODDEF) */
1090 
1091 #ifndef SELECT_POLL_UNREGISTER_METHODDEF
1092     #define SELECT_POLL_UNREGISTER_METHODDEF
1093 #endif /* !defined(SELECT_POLL_UNREGISTER_METHODDEF) */
1094 
1095 #ifndef SELECT_POLL_POLL_METHODDEF
1096     #define SELECT_POLL_POLL_METHODDEF
1097 #endif /* !defined(SELECT_POLL_POLL_METHODDEF) */
1098 
1099 #ifndef SELECT_DEVPOLL_REGISTER_METHODDEF
1100     #define SELECT_DEVPOLL_REGISTER_METHODDEF
1101 #endif /* !defined(SELECT_DEVPOLL_REGISTER_METHODDEF) */
1102 
1103 #ifndef SELECT_DEVPOLL_MODIFY_METHODDEF
1104     #define SELECT_DEVPOLL_MODIFY_METHODDEF
1105 #endif /* !defined(SELECT_DEVPOLL_MODIFY_METHODDEF) */
1106 
1107 #ifndef SELECT_DEVPOLL_UNREGISTER_METHODDEF
1108     #define SELECT_DEVPOLL_UNREGISTER_METHODDEF
1109 #endif /* !defined(SELECT_DEVPOLL_UNREGISTER_METHODDEF) */
1110 
1111 #ifndef SELECT_DEVPOLL_POLL_METHODDEF
1112     #define SELECT_DEVPOLL_POLL_METHODDEF
1113 #endif /* !defined(SELECT_DEVPOLL_POLL_METHODDEF) */
1114 
1115 #ifndef SELECT_DEVPOLL_CLOSE_METHODDEF
1116     #define SELECT_DEVPOLL_CLOSE_METHODDEF
1117 #endif /* !defined(SELECT_DEVPOLL_CLOSE_METHODDEF) */
1118 
1119 #ifndef SELECT_DEVPOLL_FILENO_METHODDEF
1120     #define SELECT_DEVPOLL_FILENO_METHODDEF
1121 #endif /* !defined(SELECT_DEVPOLL_FILENO_METHODDEF) */
1122 
1123 #ifndef SELECT_POLL_METHODDEF
1124     #define SELECT_POLL_METHODDEF
1125 #endif /* !defined(SELECT_POLL_METHODDEF) */
1126 
1127 #ifndef SELECT_DEVPOLL_METHODDEF
1128     #define SELECT_DEVPOLL_METHODDEF
1129 #endif /* !defined(SELECT_DEVPOLL_METHODDEF) */
1130 
1131 #ifndef SELECT_EPOLL_CLOSE_METHODDEF
1132     #define SELECT_EPOLL_CLOSE_METHODDEF
1133 #endif /* !defined(SELECT_EPOLL_CLOSE_METHODDEF) */
1134 
1135 #ifndef SELECT_EPOLL_FILENO_METHODDEF
1136     #define SELECT_EPOLL_FILENO_METHODDEF
1137 #endif /* !defined(SELECT_EPOLL_FILENO_METHODDEF) */
1138 
1139 #ifndef SELECT_EPOLL_FROMFD_METHODDEF
1140     #define SELECT_EPOLL_FROMFD_METHODDEF
1141 #endif /* !defined(SELECT_EPOLL_FROMFD_METHODDEF) */
1142 
1143 #ifndef SELECT_EPOLL_REGISTER_METHODDEF
1144     #define SELECT_EPOLL_REGISTER_METHODDEF
1145 #endif /* !defined(SELECT_EPOLL_REGISTER_METHODDEF) */
1146 
1147 #ifndef SELECT_EPOLL_MODIFY_METHODDEF
1148     #define SELECT_EPOLL_MODIFY_METHODDEF
1149 #endif /* !defined(SELECT_EPOLL_MODIFY_METHODDEF) */
1150 
1151 #ifndef SELECT_EPOLL_UNREGISTER_METHODDEF
1152     #define SELECT_EPOLL_UNREGISTER_METHODDEF
1153 #endif /* !defined(SELECT_EPOLL_UNREGISTER_METHODDEF) */
1154 
1155 #ifndef SELECT_EPOLL_POLL_METHODDEF
1156     #define SELECT_EPOLL_POLL_METHODDEF
1157 #endif /* !defined(SELECT_EPOLL_POLL_METHODDEF) */
1158 
1159 #ifndef SELECT_EPOLL___ENTER___METHODDEF
1160     #define SELECT_EPOLL___ENTER___METHODDEF
1161 #endif /* !defined(SELECT_EPOLL___ENTER___METHODDEF) */
1162 
1163 #ifndef SELECT_EPOLL___EXIT___METHODDEF
1164     #define SELECT_EPOLL___EXIT___METHODDEF
1165 #endif /* !defined(SELECT_EPOLL___EXIT___METHODDEF) */
1166 
1167 #ifndef SELECT_KQUEUE_CLOSE_METHODDEF
1168     #define SELECT_KQUEUE_CLOSE_METHODDEF
1169 #endif /* !defined(SELECT_KQUEUE_CLOSE_METHODDEF) */
1170 
1171 #ifndef SELECT_KQUEUE_FILENO_METHODDEF
1172     #define SELECT_KQUEUE_FILENO_METHODDEF
1173 #endif /* !defined(SELECT_KQUEUE_FILENO_METHODDEF) */
1174 
1175 #ifndef SELECT_KQUEUE_FROMFD_METHODDEF
1176     #define SELECT_KQUEUE_FROMFD_METHODDEF
1177 #endif /* !defined(SELECT_KQUEUE_FROMFD_METHODDEF) */
1178 
1179 #ifndef SELECT_KQUEUE_CONTROL_METHODDEF
1180     #define SELECT_KQUEUE_CONTROL_METHODDEF
1181 #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
1182 /*[clinic end generated code: output=cd2062a787e13b35 input=a9049054013a1b77]*/
1183