Debian Codegraph @

Modules/clinic/selectmodule.c.h

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