8000 GH-93899: fix checks for eventfd flags (GH-95170) · python-docs-tr/cpython@4dd099b · GitHub
[go: up one dir, main page]

Skip to content

Commit 4dd099b

Browse files
pythonGH-93899: fix checks for eventfd flags (pythonGH-95170)
1 parent 2b37395 commit 4dd099b

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
@@ -13107,7 +13107,7 @@ os_memfd_create_impl(PyObject *module, PyObject *name, unsigned int flags)
1310713107
}
1310813108
#endif
1310913109

13110-
#ifdef HAVE_EVENTFD
13110+
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1311113111
/*[clinic input]
1311213112
os.eventfd
1311313113
@@ -13178,7 +13178,7 @@ os_eventfd_write_impl(PyObject *module, int fd, unsigned long long value)
1317813178
}
1317913179
Py_RETURN_NONE;
1318013180
}
13181-
#endif /* HAVE_EVENTFD */
13181+
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
1318213182

1318313183
/* Terminal size querying */
1318413184

@@ -15465,11 +15465,15 @@ all_ins(PyObject *m)
1546515465
#endif
1546615466
#endif /* HAVE_MEMFD_CREATE */
1546715467

15468-
#ifdef HAVE_EVENTFD
15468+
#if defined(HAVE_EVENTFD) && defined(EFD_CLOEXEC)
1546915469
if (PyModule_AddIntMacro(m, EFD_CLOEXEC)) return -1;
15470+
#ifdef EFD_NONBLOCK
1547015471
if (PyModule_AddIntMacro(m, EFD_NONBLOCK)) return -1;
15472+
#endif
15473+
#ifdef EFD_SEMAPHORE
1547115474
if (PyModule_AddIntMacro(m, EFD_SEMAPHORE)) return -1;
1547215475
#endif
15476+
#endif /* HAVE_EVENTFD && EFD_CLOEXEC */
1547315477

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

0 commit comments

Comments
 (0)
0