• 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 (!fildes_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 (!fildes_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 (!fildes_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 (!fildes_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 (!fildes_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 (!fildes_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         if (PyFloat_Check(fastargs[0])) {
535             PyErr_SetString(PyExc_TypeError,
536                             "integer argument expected, got float" );
537             goto exit;
538         }
539         sizehint = _PyLong_AsInt(fastargs[0]);
540         if (sizehint == -1 && PyErr_Occurred()) {
541             goto exit;
542         }
543         if (!--noptargs) {
544             goto skip_optional_pos;
545         }
546     }
547     if (PyFloat_Check(fastargs[1])) {
548         PyErr_SetString(PyExc_TypeError,
549                         "integer argument expected, got float" );
550         goto exit;
551     }
552     flags = _PyLong_AsInt(fastargs[1]);
553     if (flags == -1 && PyErr_Occurred()) {
554         goto exit;
555     }
556 skip_optional_pos:
557     return_value = select_epoll_impl(type, sizehint, flags);
558 
559 exit:
560     return return_value;
561 }
562 
563 #endif /* defined(HAVE_EPOLL) */
564 
565 #if defined(HAVE_EPOLL)
566 
567 PyDoc_STRVAR(select_epoll_close__doc__,
568 "close($self, /)\n"
569 "--\n"
570 "\n"
571 "Close the epoll control file descriptor.\n"
572 "\n"
573 "Further operations on the epoll object will raise an exception.");
574 
575 #define SELECT_EPOLL_CLOSE_METHODDEF    \
576     {"close", (PyCFunction)select_epoll_close, METH_NOARGS, select_epoll_close__doc__},
577 
578 static PyObject *
579 select_epoll_close_impl(pyEpoll_Object *self);
580 
581 static PyObject *
select_epoll_close(pyEpoll_Object * self,PyObject * Py_UNUSED (ignored))582 select_epoll_close(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
583 {
584     return select_epoll_close_impl(self);
585 }
586 
587 #endif /* defined(HAVE_EPOLL) */
588 
589 #if defined(HAVE_EPOLL)
590 
591 PyDoc_STRVAR(select_epoll_fileno__doc__,
592 "fileno($self, /)\n"
593 "--\n"
594 "\n"
595 "Return the epoll control file descriptor.");
596 
597 #define SELECT_EPOLL_FILENO_METHODDEF    \
598     {"fileno", (PyCFunction)select_epoll_fileno, METH_NOARGS, select_epoll_fileno__doc__},
599 
600 static PyObject *
601 select_epoll_fileno_impl(pyEpoll_Object *self);
602 
603 static PyObject *
select_epoll_fileno(pyEpoll_Object * self,PyObject * Py_UNUSED (ignored))604 select_epoll_fileno(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
605 {
606     return select_epoll_fileno_impl(self);
607 }
608 
609 #endif /* defined(HAVE_EPOLL) */
610 
611 #if defined(HAVE_EPOLL)
612 
613 PyDoc_STRVAR(select_epoll_fromfd__doc__,
614 "fromfd($type, fd, /)\n"
615 "--\n"
616 "\n"
617 "Create an epoll object from a given control fd.");
618 
619 #define SELECT_EPOLL_FROMFD_METHODDEF    \
620     {"fromfd", (PyCFunction)select_epoll_fromfd, METH_O|METH_CLASS, select_epoll_fromfd__doc__},
621 
622 static PyObject *
623 select_epoll_fromfd_impl(PyTypeObject *type, int fd);
624 
625 static PyObject *
select_epoll_fromfd(PyTypeObject * type,PyObject * arg)626 select_epoll_fromfd(PyTypeObject *type, PyObject *arg)
627 {
628     PyObject *return_value = NULL;
629     int fd;
630 
631     if (PyFloat_Check(arg)) {
632         PyErr_SetString(PyExc_TypeError,
633                         "integer argument expected, got float" );
634         goto exit;
635     }
636     fd = _PyLong_AsInt(arg);
637     if (fd == -1 && PyErr_Occurred()) {
638         goto exit;
639     }
640     return_value = select_epoll_fromfd_impl(type, fd);
641 
642 exit:
643     return return_value;
644 }
645 
646 #endif /* defined(HAVE_EPOLL) */
647 
648 #if defined(HAVE_EPOLL)
649 
650 PyDoc_STRVAR(select_epoll_register__doc__,
651 "register($self, /, fd,\n"
652 "         eventmask=select.EPOLLIN | select.EPOLLPRI | select.EPOLLOUT)\n"
653 "--\n"
654 "\n"
655 "Registers a new fd or raises an OSError if the fd is already registered.\n"
656 "\n"
657 "  fd\n"
658 "    the target file descriptor of the operation\n"
659 "  eventmask\n"
660 "    a bit set composed of the various EPOLL constants\n"
661 "\n"
662 "The epoll interface supports all file descriptors that support poll.");
663 
664 #define SELECT_EPOLL_REGISTER_METHODDEF    \
665     {"register", (PyCFunction)(void(*)(void))select_epoll_register, METH_FASTCALL|METH_KEYWORDS, select_epoll_register__doc__},
666 
667 static PyObject *
668 select_epoll_register_impl(pyEpoll_Object *self, int fd,
669                            unsigned int eventmask);
670 
671 static PyObject *
select_epoll_register(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)672 select_epoll_register(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
673 {
674     PyObject *return_value = NULL;
675     static const char * const _keywords[] = {"fd", "eventmask", NULL};
676     static _PyArg_Parser _parser = {NULL, _keywords, "register", 0};
677     PyObject *argsbuf[2];
678     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
679     int fd;
680     unsigned int eventmask = EPOLLIN | EPOLLPRI | EPOLLOUT;
681 
682     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
683     if (!args) {
684         goto exit;
685     }
686     if (!fildes_converter(args[0], &fd)) {
687         goto exit;
688     }
689     if (!noptargs) {
690         goto skip_optional_pos;
691     }
692     if (PyFloat_Check(args[1])) {
693         PyErr_SetString(PyExc_TypeError,
694                         "integer argument expected, got float" );
695         goto exit;
696     }
697     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
698     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
699         goto exit;
700     }
701 skip_optional_pos:
702     return_value = select_epoll_register_impl(self, fd, eventmask);
703 
704 exit:
705     return return_value;
706 }
707 
708 #endif /* defined(HAVE_EPOLL) */
709 
710 #if defined(HAVE_EPOLL)
711 
712 PyDoc_STRVAR(select_epoll_modify__doc__,
713 "modify($self, /, fd, eventmask)\n"
714 "--\n"
715 "\n"
716 "Modify event mask for a registered file descriptor.\n"
717 "\n"
718 "  fd\n"
719 "    the target file descriptor of the operation\n"
720 "  eventmask\n"
721 "    a bit set composed of the various EPOLL constants");
722 
723 #define SELECT_EPOLL_MODIFY_METHODDEF    \
724     {"modify", (PyCFunction)(void(*)(void))select_epoll_modify, METH_FASTCALL|METH_KEYWORDS, select_epoll_modify__doc__},
725 
726 static PyObject *
727 select_epoll_modify_impl(pyEpoll_Object *self, int fd,
728                          unsigned int eventmask);
729 
730 static PyObject *
select_epoll_modify(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)731 select_epoll_modify(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
732 {
733     PyObject *return_value = NULL;
734     static const char * const _keywords[] = {"fd", "eventmask", NULL};
735     static _PyArg_Parser _parser = {NULL, _keywords, "modify", 0};
736     PyObject *argsbuf[2];
737     int fd;
738     unsigned int eventmask;
739 
740     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
741     if (!args) {
742         goto exit;
743     }
744     if (!fildes_converter(args[0], &fd)) {
745         goto exit;
746     }
747     if (PyFloat_Check(args[1])) {
748         PyErr_SetString(PyExc_TypeError,
749                         "integer argument expected, got float" );
750         goto exit;
751     }
752     eventmask = (unsigned int)PyLong_AsUnsignedLongMask(args[1]);
753     if (eventmask == (unsigned int)-1 && PyErr_Occurred()) {
754         goto exit;
755     }
756     return_value = select_epoll_modify_impl(self, fd, eventmask);
757 
758 exit:
759     return return_value;
760 }
761 
762 #endif /* defined(HAVE_EPOLL) */
763 
764 #if defined(HAVE_EPOLL)
765 
766 PyDoc_STRVAR(select_epoll_unregister__doc__,
767 "unregister($self, /, fd)\n"
768 "--\n"
769 "\n"
770 "Remove a registered file descriptor from the epoll object.\n"
771 "\n"
772 "  fd\n"
773 "    the target file descriptor of the operation");
774 
775 #define SELECT_EPOLL_UNREGISTER_METHODDEF    \
776     {"unregister", (PyCFunction)(void(*)(void))select_epoll_unregister, METH_FASTCALL|METH_KEYWORDS, select_epoll_unregister__doc__},
777 
778 static PyObject *
779 select_epoll_unregister_impl(pyEpoll_Object *self, int fd);
780 
781 static PyObject *
select_epoll_unregister(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)782 select_epoll_unregister(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
783 {
784     PyObject *return_value = NULL;
785     static const char * const _keywords[] = {"fd", NULL};
786     static _PyArg_Parser _parser = {NULL, _keywords, "unregister", 0};
787     PyObject *argsbuf[1];
788     int fd;
789 
790     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
791     if (!args) {
792         goto exit;
793     }
794     if (!fildes_converter(args[0], &fd)) {
795         goto exit;
796     }
797     return_value = select_epoll_unregister_impl(self, fd);
798 
799 exit:
800     return return_value;
801 }
802 
803 #endif /* defined(HAVE_EPOLL) */
804 
805 #if defined(HAVE_EPOLL)
806 
807 PyDoc_STRVAR(select_epoll_poll__doc__,
808 "poll($self, /, timeout=None, maxevents=-1)\n"
809 "--\n"
810 "\n"
811 "Wait for events on the epoll file descriptor.\n"
812 "\n"
813 "  timeout\n"
814 "    the maximum time to wait in seconds (as float);\n"
815 "    a timeout of None or -1 makes poll wait indefinitely\n"
816 "  maxevents\n"
817 "    the maximum number of events returned; -1 means no limit\n"
818 "\n"
819 "Returns a list containing any descriptors that have events to report,\n"
820 "as a list of (fd, events) 2-tuples.");
821 
822 #define SELECT_EPOLL_POLL_METHODDEF    \
823     {"poll", (PyCFunction)(void(*)(void))select_epoll_poll, METH_FASTCALL|METH_KEYWORDS, select_epoll_poll__doc__},
824 
825 static PyObject *
826 select_epoll_poll_impl(pyEpoll_Object *self, PyObject *timeout_obj,
827                        int maxevents);
828 
829 static PyObject *
select_epoll_poll(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)830 select_epoll_poll(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
831 {
832     PyObject *return_value = NULL;
833     static const char * const _keywords[] = {"timeout", "maxevents", NULL};
834     static _PyArg_Parser _parser = {NULL, _keywords, "poll", 0};
835     PyObject *argsbuf[2];
836     Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
837     PyObject *timeout_obj = Py_None;
838     int maxevents = -1;
839 
840     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 2, 0, argsbuf);
841     if (!args) {
842         goto exit;
843     }
844     if (!noptargs) {
845         goto skip_optional_pos;
846     }
847     if (args[0]) {
848         timeout_obj = args[0];
849         if (!--noptargs) {
850             goto skip_optional_pos;
851         }
852     }
853     if (PyFloat_Check(args[1])) {
854         PyErr_SetString(PyExc_TypeError,
855                         "integer argument expected, got float" );
856         goto exit;
857     }
858     maxevents = _PyLong_AsInt(args[1]);
859     if (maxevents == -1 && PyErr_Occurred()) {
860         goto exit;
861     }
862 skip_optional_pos:
863     return_value = select_epoll_poll_impl(self, timeout_obj, maxevents);
864 
865 exit:
866     return return_value;
867 }
868 
869 #endif /* defined(HAVE_EPOLL) */
870 
871 #if defined(HAVE_EPOLL)
872 
873 PyDoc_STRVAR(select_epoll___enter____doc__,
874 "__enter__($self, /)\n"
875 "--\n"
876 "\n");
877 
878 #define SELECT_EPOLL___ENTER___METHODDEF    \
879     {"__enter__", (PyCFunction)select_epoll___enter__, METH_NOARGS, select_epoll___enter____doc__},
880 
881 static PyObject *
882 select_epoll___enter___impl(pyEpoll_Object *self);
883 
884 static PyObject *
select_epoll___enter__(pyEpoll_Object * self,PyObject * Py_UNUSED (ignored))885 select_epoll___enter__(pyEpoll_Object *self, PyObject *Py_UNUSED(ignored))
886 {
887     return select_epoll___enter___impl(self);
888 }
889 
890 #endif /* defined(HAVE_EPOLL) */
891 
892 #if defined(HAVE_EPOLL)
893 
894 PyDoc_STRVAR(select_epoll___exit____doc__,
895 "__exit__($self, exc_type=None, exc_value=None, exc_tb=None, /)\n"
896 "--\n"
897 "\n");
898 
899 #define SELECT_EPOLL___EXIT___METHODDEF    \
900     {"__exit__", (PyCFunction)(void(*)(void))select_epoll___exit__, METH_FASTCALL, select_epoll___exit____doc__},
901 
902 static PyObject *
903 select_epoll___exit___impl(pyEpoll_Object *self, PyObject *exc_type,
904                            PyObject *exc_value, PyObject *exc_tb);
905 
906 static PyObject *
select_epoll___exit__(pyEpoll_Object * self,PyObject * const * args,Py_ssize_t nargs)907 select_epoll___exit__(pyEpoll_Object *self, PyObject *const *args, Py_ssize_t nargs)
908 {
909     PyObject *return_value = NULL;
910     PyObject *exc_type = Py_None;
911     PyObject *exc_value = Py_None;
912     PyObject *exc_tb = Py_None;
913 
914     if (!_PyArg_CheckPositional("__exit__", nargs, 0, 3)) {
915         goto exit;
916     }
917     if (nargs < 1) {
918         goto skip_optional;
919     }
920     exc_type = args[0];
921     if (nargs < 2) {
922         goto skip_optional;
923     }
924     exc_value = args[1];
925     if (nargs < 3) {
926         goto skip_optional;
927     }
928     exc_tb = args[2];
929 skip_optional:
930     return_value = select_epoll___exit___impl(self, exc_type, exc_value, exc_tb);
931 
932 exit:
933     return return_value;
934 }
935 
936 #endif /* defined(HAVE_EPOLL) */
937 
938 #if defined(HAVE_KQUEUE)
939 
940 PyDoc_STRVAR(select_kqueue__doc__,
941 "kqueue()\n"
942 "--\n"
943 "\n"
944 "Kqueue syscall wrapper.\n"
945 "\n"
946 "For example, to start watching a socket for input:\n"
947 ">>> kq = kqueue()\n"
948 ">>> sock = socket()\n"
949 ">>> sock.connect((host, port))\n"
950 ">>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_ADD)], 0)\n"
951 "\n"
952 "To wait one second for it to become writeable:\n"
953 ">>> kq.control(None, 1, 1000)\n"
954 "\n"
955 "To stop listening:\n"
956 ">>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_DELETE)], 0)");
957 
958 static PyObject *
959 select_kqueue_impl(PyTypeObject *type);
960 
961 static PyObject *
select_kqueue(PyTypeObject * type,PyObject * args,PyObject * kwargs)962 select_kqueue(PyTypeObject *type, PyObject *args, PyObject *kwargs)
963 {
964     PyObject *return_value = NULL;
965 
966     if ((type == _selectstate_global->kqueue_queue_Type) &&
967         !_PyArg_NoPositional("kqueue", args)) {
968         goto exit;
969     }
970     if ((type == _selectstate_global->kqueue_queue_Type) &&
971         !_PyArg_NoKeywords("kqueue", kwargs)) {
972         goto exit;
973     }
974     return_value = select_kqueue_impl(type);
975 
976 exit:
977     return return_value;
978 }
979 
980 #endif /* defined(HAVE_KQUEUE) */
981 
982 #if defined(HAVE_KQUEUE)
983 
984 PyDoc_STRVAR(select_kqueue_close__doc__,
985 "close($self, /)\n"
986 "--\n"
987 "\n"
988 "Close the kqueue control file descriptor.\n"
989 "\n"
990 "Further operations on the kqueue object will raise an exception.");
991 
992 #define SELECT_KQUEUE_CLOSE_METHODDEF    \
993     {"close", (PyCFunction)select_kqueue_close, METH_NOARGS, select_kqueue_close__doc__},
994 
995 static PyObject *
996 select_kqueue_close_impl(kqueue_queue_Object *self);
997 
998 static PyObject *
select_kqueue_close(kqueue_queue_Object * self,PyObject * Py_UNUSED (ignored))999 select_kqueue_close(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored))
1000 {
1001     return select_kqueue_close_impl(self);
1002 }
1003 
1004 #endif /* defined(HAVE_KQUEUE) */
1005 
1006 #if defined(HAVE_KQUEUE)
1007 
1008 PyDoc_STRVAR(select_kqueue_fileno__doc__,
1009 "fileno($self, /)\n"
1010 "--\n"
1011 "\n"
1012 "Return the kqueue control file descriptor.");
1013 
1014 #define SELECT_KQUEUE_FILENO_METHODDEF    \
1015     {"fileno", (PyCFunction)select_kqueue_fileno, METH_NOARGS, select_kqueue_fileno__doc__},
1016 
1017 static PyObject *
1018 select_kqueue_fileno_impl(kqueue_queue_Object *self);
1019 
1020 static PyObject *
select_kqueue_fileno(kqueue_queue_Object * self,PyObject * Py_UNUSED (ignored))1021 select_kqueue_fileno(kqueue_queue_Object *self, PyObject *Py_UNUSED(ignored))
1022 {
1023     return select_kqueue_fileno_impl(self);
1024 }
1025 
1026 #endif /* defined(HAVE_KQUEUE) */
1027 
1028 #if defined(HAVE_KQUEUE)
1029 
1030 PyDoc_STRVAR(select_kqueue_fromfd__doc__,
1031 "fromfd($type, fd, /)\n"
1032 "--\n"
1033 "\n"
1034 "Create a kqueue object from a given control fd.");
1035 
1036 #define SELECT_KQUEUE_FROMFD_METHODDEF    \
1037     {"fromfd", (PyCFunction)select_kqueue_fromfd, METH_O|METH_CLASS, select_kqueue_fromfd__doc__},
1038 
1039 static PyObject *
1040 select_kqueue_fromfd_impl(PyTypeObject *type, int fd);
1041 
1042 static PyObject *
select_kqueue_fromfd(PyTypeObject * type,PyObject * arg)1043 select_kqueue_fromfd(PyTypeObject *type, PyObject *arg)
1044 {
1045     PyObject *return_value = NULL;
1046     int fd;
1047 
1048     if (PyFloat_Check(arg)) {
1049         PyErr_SetString(PyExc_TypeError,
1050                         "integer argument expected, got float" );
1051         goto exit;
1052     }
1053     fd = _PyLong_AsInt(arg);
1054     if (fd == -1 && PyErr_Occurred()) {
1055         goto exit;
1056     }
1057     return_value = select_kqueue_fromfd_impl(type, fd);
1058 
1059 exit:
1060     return return_value;
1061 }
1062 
1063 #endif /* defined(HAVE_KQUEUE) */
1064 
1065 #if defined(HAVE_KQUEUE)
1066 
1067 PyDoc_STRVAR(select_kqueue_control__doc__,
1068 "control($self, changelist, maxevents, timeout=None, /)\n"
1069 "--\n"
1070 "\n"
1071 "Calls the kernel kevent function.\n"
1072 "\n"
1073 "  changelist\n"
1074 "    Must be an iterable of kevent objects describing the changes to be made\n"
1075 "    to the kernel\'s watch list or None.\n"
1076 "  maxevents\n"
1077 "    The maximum number of events that the kernel will return.\n"
1078 "  timeout\n"
1079 "    The maximum time to wait in seconds, or else None to wait forever.\n"
1080 "    This accepts floats for smaller timeouts, too.");
1081 
1082 #define SELECT_KQUEUE_CONTROL_METHODDEF    \
1083     {"control", (PyCFunction)(void(*)(void))select_kqueue_control, METH_FASTCALL, select_kqueue_control__doc__},
1084 
1085 static PyObject *
1086 select_kqueue_control_impl(kqueue_queue_Object *self, PyObject *changelist,
1087                            int maxevents, PyObject *otimeout);
1088 
1089 static PyObject *
select_kqueue_control(kqueue_queue_Object * self,PyObject * const * args,Py_ssize_t nargs)1090 select_kqueue_control(kqueue_queue_Object *self, PyObject *const *args, Py_ssize_t nargs)
1091 {
1092     PyObject *return_value = NULL;
1093     PyObject *changelist;
1094     int maxevents;
1095     PyObject *otimeout = Py_None;
1096 
1097     if (!_PyArg_CheckPositional("control", nargs, 2, 3)) {
1098         goto exit;
1099     }
1100     changelist = args[0];
1101     if (PyFloat_Check(args[1])) {
1102         PyErr_SetString(PyExc_TypeError,
1103                         "integer argument expected, got float" );
1104         goto exit;
1105     }
1106     maxevents = _PyLong_AsInt(args[1]);
1107     if (maxevents == -1 && PyErr_Occurred()) {
1108         goto exit;
1109     }
1110     if (nargs < 3) {
1111         goto skip_optional;
1112     }
1113     otimeout = args[2];
1114 skip_optional:
1115     return_value = select_kqueue_control_impl(self, changelist, maxevents, otimeout);
1116 
1117 exit:
1118     return return_value;
1119 }
1120 
1121 #endif /* defined(HAVE_KQUEUE) */
1122 
1123 #ifndef SELECT_POLL_REGISTER_METHODDEF
1124     #define SELECT_POLL_REGISTER_METHODDEF
1125 #endif /* !defined(SELECT_POLL_REGISTER_METHODDEF) */
1126 
1127 #ifndef SELECT_POLL_MODIFY_METHODDEF
1128     #define SELECT_POLL_MODIFY_METHODDEF
1129 #endif /* !defined(SELECT_POLL_MODIFY_METHODDEF) */
1130 
1131 #ifndef SELECT_POLL_UNREGISTER_METHODDEF
1132     #define SELECT_POLL_UNREGISTER_METHODDEF
1133 #endif /* !defined(SELECT_POLL_UNREGISTER_METHODDEF) */
1134 
1135 #ifndef SELECT_POLL_POLL_METHODDEF
1136     #define SELECT_POLL_POLL_METHODDEF
1137 #endif /* !defined(SELECT_POLL_POLL_METHODDEF) */
1138 
1139 #ifndef SELECT_DEVPOLL_REGISTER_METHODDEF
1140     #define SELECT_DEVPOLL_REGISTER_METHODDEF
1141 #endif /* !defined(SELECT_DEVPOLL_REGISTER_METHODDEF) */
1142 
1143 #ifndef SELECT_DEVPOLL_MODIFY_METHODDEF
1144     #define SELECT_DEVPOLL_MODIFY_METHODDEF
1145 #endif /* !defined(SELECT_DEVPOLL_MODIFY_METHODDEF) */
1146 
1147 #ifndef SELECT_DEVPOLL_UNREGISTER_METHODDEF
1148     #define SELECT_DEVPOLL_UNREGISTER_METHODDEF
1149 #endif /* !defined(SELECT_DEVPOLL_UNREGISTER_METHODDEF) */
1150 
1151 #ifndef SELECT_DEVPOLL_POLL_METHODDEF
1152     #define SELECT_DEVPOLL_POLL_METHODDEF
1153 #endif /* !defined(SELECT_DEVPOLL_POLL_METHODDEF) */
1154 
1155 #ifndef SELECT_DEVPOLL_CLOSE_METHODDEF
1156     #define SELECT_DEVPOLL_CLOSE_METHODDEF
1157 #endif /* !defined(SELECT_DEVPOLL_CLOSE_METHODDEF) */
1158 
1159 #ifndef SELECT_DEVPOLL_FILENO_METHODDEF
1160     #define SELECT_DEVPOLL_FILENO_METHODDEF
1161 #endif /* !defined(SELECT_DEVPOLL_FILENO_METHODDEF) */
1162 
1163 #ifndef SELECT_POLL_METHODDEF
1164     #define SELECT_POLL_METHODDEF
1165 #endif /* !defined(SELECT_POLL_METHODDEF) */
1166 
1167 #ifndef SELECT_DEVPOLL_METHODDEF
1168     #define SELECT_DEVPOLL_METHODDEF
1169 #endif /* !defined(SELECT_DEVPOLL_METHODDEF) */
1170 
1171 #ifndef SELECT_EPOLL_CLOSE_METHODDEF
1172     #define SELECT_EPOLL_CLOSE_METHODDEF
1173 #endif /* !defined(SELECT_EPOLL_CLOSE_METHODDEF) */
1174 
1175 #ifndef SELECT_EPOLL_FILENO_METHODDEF
1176     #define SELECT_EPOLL_FILENO_METHODDEF
1177 #endif /* !defined(SELECT_EPOLL_FILENO_METHODDEF) */
1178 
1179 #ifndef SELECT_EPOLL_FROMFD_METHODDEF
1180     #define SELECT_EPOLL_FROMFD_METHODDEF
1181 #endif /* !defined(SELECT_EPOLL_FROMFD_METHODDEF) */
1182 
1183 #ifndef SELECT_EPOLL_REGISTER_METHODDEF
1184     #define SELECT_EPOLL_REGISTER_METHODDEF
1185 #endif /* !defined(SELECT_EPOLL_REGISTER_METHODDEF) */
1186 
1187 #ifndef SELECT_EPOLL_MODIFY_METHODDEF
1188     #define SELECT_EPOLL_MODIFY_METHODDEF
1189 #endif /* !defined(SELECT_EPOLL_MODIFY_METHODDEF) */
1190 
1191 #ifndef SELECT_EPOLL_UNREGISTER_METHODDEF
1192     #define SELECT_EPOLL_UNREGISTER_METHODDEF
1193 #endif /* !defined(SELECT_EPOLL_UNREGISTER_METHODDEF) */
1194 
1195 #ifndef SELECT_EPOLL_POLL_METHODDEF
1196     #define SELECT_EPOLL_POLL_METHODDEF
1197 #endif /* !defined(SELECT_EPOLL_POLL_METHODDEF) */
1198 
1199 #ifndef SELECT_EPOLL___ENTER___METHODDEF
1200     #define SELECT_EPOLL___ENTER___METHODDEF
1201 #endif /* !defined(SELECT_EPOLL___ENTER___METHODDEF) */
1202 
1203 #ifndef SELECT_EPOLL___EXIT___METHODDEF
1204     #define SELECT_EPOLL___EXIT___METHODDEF
1205 #endif /* !defined(SELECT_EPOLL___EXIT___METHODDEF) */
1206 
1207 #ifndef SELECT_KQUEUE_CLOSE_METHODDEF
1208     #define SELECT_KQUEUE_CLOSE_METHODDEF
1209 #endif /* !defined(SELECT_KQUEUE_CLOSE_METHODDEF) */
1210 
1211 #ifndef SELECT_KQUEUE_FILENO_METHODDEF
1212     #define SELECT_KQUEUE_FILENO_METHODDEF
1213 #endif /* !defined(SELECT_KQUEUE_FILENO_METHODDEF) */
1214 
1215 #ifndef SELECT_KQUEUE_FROMFD_METHODDEF
1216     #define SELECT_KQUEUE_FROMFD_METHODDEF
1217 #endif /* !defined(SELECT_KQUEUE_FROMFD_METHODDEF) */
1218 
1219 #ifndef SELECT_KQUEUE_CONTROL_METHODDEF
1220     #define SELECT_KQUEUE_CONTROL_METHODDEF
1221 #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
1222 /*[clinic end generated code: output=ef42c3485a8fe3a0 input=a9049054013a1b77]*/
1223