Skip to content

Commit

Permalink
[3.10] GH-93899: fix checks for eventfd flags (GH-95170). (#95345)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4dd099b)

Co-authored-by: Kumar Aditya <[email protected]>
  • Loading branch information
kumaraditya303 authored Jul 28, 2022
1 parent 563f058 commit 4ad2229
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +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.
14 changes: 7 additions & 7 deletions Modules/clinic/posixmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -13044,7 +13044,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
Expand Down Expand Up @@ -13115,7 +13115,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 */

Expand Down Expand Up @@ -15401,11 +15401,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;
Expand Down

0 comments on commit 4ad2229

Please sign in to comment.