8000 [3.10] GH-93899: fix checks for eventfd flags (GH-95170). (#95345) · python/cpython@4ad2229 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ad2229

Browse files
[3.10] GH-93899: fix checks for eventfd flags (GH-95170). (#95345)
(cherry picked from commit 4dd099b) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
1 parent 563f058 commit 4ad2229

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
@@ -13044,7 +13044,7 @@ os_memfd_create_impl(PyObject *module, PyObject *name, unsigned int flags)
1304413044
}
1304513045
#endif
1304613046

13047-
#ifdef HAVE_EVENTFD
13047+
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1304813048
/*[clinic input]
1304913049
os.eventfd
1305013050
@@ -13115,7 +13115,7 @@ os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value)
1311513115
}
1311613116
Py_RETURN_NONE;
1311713117
}
13118-
#endif /* HAVE_EVENTFD */
13118+
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
1311913119

1312013120
/* Terminal size querying */
1312113121

@@ -15401,11 +15401,15 @@ all_ins(PyObject *m)
1540115401
#endif
1540215402
#endif /* HAVE_MEMFD_CREATE */
1540315403

15404-
#ifdef HAVE_EVENTFD
15404+
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1540515405
if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1;
15406+
#ifdef EFD_NONBLOCK
1540615407
if (PyModule_AddIntMacro(m, EFD_NONBLOCK)) return -1;
15408+
#endif
15409+
#ifdef EFD_SEMAPHORE
1540715410
if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1;
1540815411
#endif
15412+
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
1540915413

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

0 commit comments

Comments
 (0)
0