8000 [3.11] GH-93899: fix checks for eventfd flags (GH-95170). (#95342) · python/cpython@7813d97 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7813d97

Browse files
[3.11] GH-93899: fix checks for eventfd flags (GH-95170). (#95342)
(cherry picked from commit 4dd099b) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
1 parent 33efd7f commit 7813d97

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix check for existence of :data:`os.EFD_CLOEXEC`, :data:`os.EFD_NONBLOCK` and :data:`os.EFD_SEMAPHORE` flags on older kernel versions where these flags are not present. Patch by Kumar Aditya.

Modules/clinic/posixmodule.c.h

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13134,7 +13134,7 @@ os_memfd_create_impl(PyObject *module, PyObject *name, unsigned int flags)
1313413134
}
1313513135
#endif
1313613136

13137-
#ifdef HAVE_EVENTFD
13137+
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1313813138
/*[clinic input]
1313913139
os.eventfd
1314013140
@@ -13205,7 +13205,7 @@ os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value)
1320513205
}
1320613206
Py_RETURN_NONE;
1320713207
}
13208-
#endif /* HAVE_EVENTFD */
13208+
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
1320913209

1321013210
/* Terminal size querying */
1321113211

@@ -15505,11 +15505,15 @@ all_ins(PyObject *m)
1550515505
#endif
1550615506
#endif /* HAVE_MEMFD_CREATE */
1550715507

15508-
#ifdef HAVE_EVENTFD
15508+
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1550915509
if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1;
15510+
#ifdef EFD_NONBLOCK
1551015511
if (PyModule_AddIntMacro(m, EFD_NONBLOCK)) return -1;
15512+
#endif
15513+
#ifdef EFD_SEMAPHORE
1551115514
if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1;
1551215515
#endif
15516+
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
1551315517

1551415518
#if defined(__APPLE__)
1551515519
if (PyModule_AddIntConstant(m, "_COPYFILE_DATA", COPYFILE_DATA)) return -1;

0 commit comments

Comments
 (0)
0