]> granicus.if.org Git - python/commitdiff
Issue #27567: Expose the POLLRDHUP constant in the select module
authorBerker Peksag <berker.peksag@gmail.com>
Tue, 19 Jul 2016 18:09:26 +0000 (21:09 +0300)
committerBerker Peksag <berker.peksag@gmail.com>
Tue, 19 Jul 2016 18:09:26 +0000 (21:09 +0300)
Doc/library/select.rst
Misc/NEWS
Modules/selectmodule.c

index 4fafb117b8db8914047e32ee41e9a6173ae00dc5..5494eef17322b80743b2a8498c9e5d73ad9f3581 100644 (file)
@@ -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     |
    +-------------------+------------------------------------------+
 
index 803bef0563d781ede3ea8277207f49369768438f..16d447659fc79c51d63d7c6477c0ce015ef6c1de 100644 (file)
--- 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.
 
index c84c3cc26b562c44d82e8a7035f7e3ba27701927..0f90ce259aa6d30601351684011ede33daf5c44a 100644 (file)
@@ -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>
 
@@ -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 */