From: Berker Peksag Date: Tue, 19 Jul 2016 18:09:26 +0000 (+0300) Subject: Issue #27567: Expose the POLLRDHUP constant in the select module X-Git-Tag: v3.6.0a4~144 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fe8d9666575284c10b6bf803b9c446523da1d23a;p=python Issue #27567: Expose the POLLRDHUP constant in the select module --- diff --git a/Doc/library/select.rst b/Doc/library/select.rst index 4fafb117b8..5494eef173 100644 --- a/Doc/library/select.rst +++ b/Doc/library/select.rst @@ -391,6 +391,9 @@ linearly scanned again. :c:func:`select` is O(highest file descriptor), while +-------------------+------------------------------------------+ | :const:`POLLHUP` | Hung up | +-------------------+------------------------------------------+ + | :const:`POLLRDHUP`| Stream socket peer closed connection, or | + | | shut down writing half of connection | + +-------------------+------------------------------------------+ | :const:`POLLNVAL` | Invalid request: descriptor not open | +-------------------+------------------------------------------+ diff --git a/Misc/NEWS b/Misc/NEWS index 803bef0563..16d447659f 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -28,7 +28,8 @@ Library - Expose the EPOLLEXCLUSIVE constant (when it is defined) in the select module. -- Issue #27567: Expose the EPOLLRDHUP constant in the select module. +- Issue #27567: Expose the EPOLLRDHUP and POLLRDHUP constants in the select + module. - Issue #1621: Avoid signed int negation overflow in the "audioop" module. diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index c84c3cc26b..0f90ce259a 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 @@ -2451,6 +2455,10 @@ PyInit_select(void) #endif #ifdef POLLMSG PyModule_AddIntMacro(m, POLLMSG); +#endif +#ifdef POLLRDHUP + /* Kernel 2.6.17+ */ + PyModule_AddIntMacro(m, POLLRDHUP); #endif } #endif /* HAVE_POLL */