Skip to content

Commit 7b2495e

Browse files
mtelkaencukou
andauthored
gh-138850: Add --disable-epoll to configure (GH-145768)
* gh-138850: Add --disable-epoll to configure Co-authored-by: Petr Viktorin <encukou@gmail.com>
1 parent 382c043 commit 7b2495e

File tree

5 files changed

+59
-3
lines changed

5 files changed

+59
-3
lines changed

Doc/library/select.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The module defines the following:
6262

6363
*sizehint* informs epoll about the expected number of events to be
6464
registered. It must be positive, or ``-1`` to use the default. It is only
65-
used on older systems where :c:func:`!epoll_create1` is not available;
65+
used on older systems where :manpage:`epoll_create1(2)` is not available;
6666
otherwise it has no effect (though its value is still checked).
6767

6868
*flags* is deprecated and completely ignored. However, when supplied, its
@@ -89,6 +89,11 @@ The module defines the following:
8989
The *flags* parameter. ``select.EPOLL_CLOEXEC`` is used by default now.
9090
Use :func:`os.set_inheritable` to make the file descriptor inheritable.
9191

92+
.. versionchanged:: next
93+
94+
When CPython is built, this function may be disabled using
95+
:option:`--disable-epoll`.
96+
9297

9398
.. function:: poll()
9499

Doc/using/configure.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,17 @@ General Options
463463

464464
``pkg-config`` options.
465465

466+
.. option:: --disable-epoll
467+
468+
Build without ``epoll``, meaning that :py:func:`select.epoll` will not be
469+
present even if the system provides an
470+
:manpage:`epoll_create <epoll_create(2)>` function.
471+
This may be used on systems where :manpage:`!epoll_create` or
472+
:manpage:`epoll_create1 <epoll_create1(2)>` is available
473+
but incompatible with Linux semantics.
474+
475+
.. versionadded:: next
476+
466477

467478
C compiler options
468479
------------------
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add :option:`--disable-epoll` to ``configure``

configure

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

configure.ac

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5389,8 +5389,20 @@ PY_CHECK_FUNC([symlink], [@%:@include <unistd.h>])
53895389
PY_CHECK_FUNC([fchdir], [@%:@include <unistd.h>])
53905390
PY_CHECK_FUNC([fsync], [@%:@include <unistd.h>])
53915391
PY_CHECK_FUNC([fdatasync], [@%:@include <unistd.h>])
5392-
PY_CHECK_FUNC([epoll_create], [@%:@include <sys/epoll.h>], [HAVE_EPOLL])
5393-
PY_CHECK_FUNC([epoll_create1], [@%:@include <sys/epoll.h>])
5392+
5393+
AC_MSG_CHECKING([for --disable-epoll])
5394+
AC_ARG_ENABLE([epoll],
5395+
[AS_HELP_STRING([--disable-epoll], [disable epoll (default is yes if supported)])],
5396+
[AS_VAR_IF([enable_epoll], [no], [disable_epoll=yes], [disable_epoll=no])],
5397+
[disable_epoll=no]
5398+
)
5399+
AC_MSG_RESULT([$disable_epoll])
5400+
if test "$disable_epoll" = "no"
5401+
then
5402+
PY_CHECK_FUNC([epoll_create], [@%:@include <sys/epoll.h>], [HAVE_EPOLL])
5403+
PY_CHECK_FUNC([epoll_create1], [@%:@include <sys/epoll.h>])
5404+
fi
5405+
53945406
PY_CHECK_FUNC([kqueue],[
53955407
#include <sys/types.h>
53965408
#include <sys/event.h>

0 commit comments

Comments
 (0)