diff options
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r-- | Modules/selectmodule.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 00324a5..0f90ce2 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -4,6 +4,10 @@ have any value except INVALID_SOCKET. */ +#if defined(HAVE_POLL_H) && !defined(_GNU_SOURCE) +#define _GNU_SOURCE +#endif + #include "Python.h" #include <structmember.h> @@ -1842,7 +1846,7 @@ kqueue_event_init(kqueue_event_Object *self, PyObject *args, PyObject *kwds) PyObject *pfd; static char *kwlist[] = {"ident", "filter", "flags", "fflags", "data", "udata", NULL}; - static char *fmt = "O|hHI" DATA_FMT_UNIT UINTPTRT_FMT_UNIT ":kevent"; + static const char fmt[] = "O|hHI" DATA_FMT_UNIT UINTPTRT_FMT_UNIT ":kevent"; EV_SET(&(self->e), 0, EVFILT_READ, EV_ADD, 0, 0, 0); /* defaults */ @@ -2127,7 +2131,7 @@ kqueue_queue_control(kqueue_queue_Object *self, PyObject *args) if (_PyTime_FromSecondsObject(&timeout, otimeout, _PyTime_ROUND_CEILING) < 0) { PyErr_Format(PyExc_TypeError, - "timeout argument must be an number " + "timeout argument must be a number " "or None, got %.200s", Py_TYPE(otimeout)->tp_name); return NULL; @@ -2452,6 +2456,10 @@ PyInit_select(void) #ifdef POLLMSG PyModule_AddIntMacro(m, POLLMSG); #endif +#ifdef POLLRDHUP + /* Kernel 2.6.17+ */ + PyModule_AddIntMacro(m, POLLRDHUP); +#endif } #endif /* HAVE_POLL */ @@ -2473,12 +2481,15 @@ PyInit_select(void) PyModule_AddIntMacro(m, EPOLLPRI); PyModule_AddIntMacro(m, EPOLLERR); PyModule_AddIntMacro(m, EPOLLHUP); + PyModule_AddIntMacro(m, EPOLLRDHUP); PyModule_AddIntMacro(m, EPOLLET); #ifdef EPOLLONESHOT /* Kernel 2.6.2+ */ PyModule_AddIntMacro(m, EPOLLONESHOT); #endif - /* PyModule_AddIntConstant(m, "EPOLL_RDHUP", EPOLLRDHUP); */ +#ifdef EPOLLEXCLUSIVE + PyModule_AddIntMacro(m, EPOLLEXCLUSIVE); +#endif #ifdef EPOLLRDNORM PyModule_AddIntMacro(m, EPOLLRDNORM); |