summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-07-28 10:24:36 (GMT)
committerGitHub <noreply@github.com>2022-07-28 10:24:36 (GMT)
commit7813d976aeaabea0a232f3c782e4fc25fe93a27d (patch)
tree729c5458843ad1c4c8cd053c0c108e5fe67ce1ba /Modules/posixmodule.c
parent33efd7f7a3e3af172c93675d13d71916a3614b86 (diff)
downloadcpython-7813d976aeaabea0a232f3c782e4fc25fe93a27d.zip
cpython-7813d976aeaabea0a232f3c782e4fc25fe93a27d.tar.gz
cpython-7813d976aeaabea0a232f3c782e4fc25fe93a27d.tar.bz2
[3.11] GH-93899: fix checks for eventfd flags (GH-95170). (#95342)
(cherry picked from commit 4dd099bafff14639ef5d2185965016d8f253353f) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index d7cac2b..f97013f 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -13134,7 +13134,7 @@ os_memfd_create_impl(PyObject *module, PyObject *name, unsigned int flags)
}
#endif
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
/*[clinic input]
os.eventfd
@@ -13205,7 +13205,7 @@ os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value)
}
Py_RETURN_NONE;
}
-#endif /* HAVE_EVENTFD */
+#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
/* Terminal size querying */
@@ -15505,11 +15505,15 @@ all_ins(PyObject *m)
#endif
#endif /* HAVE_MEMFD_CREATE */
-#ifdef HAVE_EVENTFD
+#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1;
+#ifdef EFD_NONBLOCK
if (PyModule_AddIntMacro(m, EFD_NONBLOCK)) return -1;
+#endif
+#ifdef EFD_SEMAPHORE
if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1;
#endif
+#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
#if defined(__APPLE__)
if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;