]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138850: Add --disable-epoll to configure (GH-145768)
authorMarcel Telka <marcel@telka.sk>
Mon, 30 Mar 2026 09:55:42 +0000 (11:55 +0200)
committerGitHub <noreply@github.com>
Mon, 30 Mar 2026 09:55:42 +0000 (11:55 +0200)
* gh-138850: Add --disable-epoll to configure

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Doc/library/select.rst
Doc/using/configure.rst
Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst [new file with mode: 0644]
configure
configure.ac

index f6d8ce3c30ff1dbe8f9c63f68798c74e231816d1..6c4a55612180a3e1ed4089318c52e342e84817ec 100644 (file)
@@ -62,7 +62,7 @@ The module defines the following:
 
    *sizehint* informs epoll about the expected number of events to be
    registered.  It must be positive, or ``-1`` to use the default. It is only
-   used on older systems where :c:func:`!epoll_create1` is not available;
+   used on older systems where :manpage:`epoll_create1(2)` is not available;
    otherwise it has no effect (though its value is still checked).
 
    *flags* is deprecated and completely ignored.  However, when supplied, its
@@ -89,6 +89,11 @@ The module defines the following:
       The *flags* parameter.  ``select.EPOLL_CLOEXEC`` is used by default now.
       Use :func:`os.set_inheritable` to make the file descriptor inheritable.
 
+   .. versionchanged:: next
+
+      When CPython is built, this function may be disabled using
+      :option:`--disable-epoll`.
+
 
 .. function:: poll()
 
index 084c27d2155d0b67c9d41da5dda85fcf359f3495..b218325b140d43eacc488de64db4d63b2a14a51d 100644 (file)
@@ -463,6 +463,17 @@ General Options
 
    ``pkg-config`` options.
 
+.. option:: --disable-epoll
+
+   Build without ``epoll``, meaning that :py:func:`select.epoll` will not be
+   present even if the system provides an
+   :manpage:`epoll_create <epoll_create(2)>` function.
+   This may be used on systems where :manpage:`!epoll_create` or
+   :manpage:`epoll_create1 <epoll_create1(2)>` is available
+   but incompatible with Linux semantics.
+
+   .. versionadded:: next
+
 
 C compiler options
 ------------------
diff --git a/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst b/Misc/NEWS.d/next/Build/2026-03-10-16-58-55.gh-issue-138850.CkqTw6.rst
new file mode 100644 (file)
index 0000000..256f13b
--- /dev/null
@@ -0,0 +1 @@
+Add :option:`--disable-epoll` to ``configure``
index 0c65e5c11e669a59e03131a2762d1b168391a5cb..c958b2bf5d84a83b2ed5ff571b168815daa2cc61 100755 (executable)
--- a/configure
+++ b/configure
@@ -1133,6 +1133,7 @@ with_pymalloc_hugepages
 with_c_locale_coercion
 with_valgrind
 with_dtrace
+enable_epoll
 with_libm
 with_libc
 enable_big_digits
@@ -1856,6 +1857,7 @@ Optional Features:
                           see Doc/library/sqlite3.rst (default is no)
   --enable-ipv6           enable ipv6 (with ipv4) support, see
                           Doc/library/socket.rst (default is yes if supported)
+  --disable-epoll         disable epoll (default is yes if supported)
   --enable-big-digits[=15|30]
                           use big digits (30 or 15 bits) for Python longs
                           (default is 30)]
 
 
 
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for --disable-epoll" >&5
+printf %s "checking for --disable-epoll... " >&6; }
+# Check whether --enable-epoll was given.
+if test ${enable_epoll+y}
+then :
+  enableval=$enable_epoll; if test "x$enable_epoll" = xno
+then :
+  disable_epoll=yes
+else case e in #(
+  e) disable_epoll=no ;;
+esac
+fi
+else case e in #(
+  e) disable_epoll=no
+ ;;
+esac
+fi
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $disable_epoll" >&5
+printf "%s\n" "$disable_epoll" >&6; }
+if test "$disable_epoll" = "no"
+then
+
 
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for epoll_create" >&5
 printf %s "checking for epoll_create... " >&6; }
@@ -21087,6 +21112,8 @@ fi
 
 
 
+fi
+
 
 
   { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for kqueue" >&5
index bef76c92d0adf94e17208a78c0af30eb6276da17..75aa6519e89197e3e655b3cbcc436cbe16e44ad6 100644 (file)
@@ -5389,8 +5389,20 @@ PY_CHECK_FUNC([symlink], [@%:@include <unistd.h>])
 PY_CHECK_FUNC([fchdir], [@%:@include <unistd.h>])
 PY_CHECK_FUNC([fsync], [@%:@include <unistd.h>])
 PY_CHECK_FUNC([fdatasync], [@%:@include <unistd.h>])
-PY_CHECK_FUNC([epoll_create], [@%:@include <sys/epoll.h>], [HAVE_EPOLL])
-PY_CHECK_FUNC([epoll_create1], [@%:@include <sys/epoll.h>])
+
+AC_MSG_CHECKING([for --disable-epoll])
+AC_ARG_ENABLE([epoll],
+  [AS_HELP_STRING([--disable-epoll], [disable epoll (default is yes if supported)])],
+  [AS_VAR_IF([enable_epoll], [no], [disable_epoll=yes], [disable_epoll=no])],
+  [disable_epoll=no]
+)
+AC_MSG_RESULT([$disable_epoll])
+if test "$disable_epoll" = "no"
+then
+  PY_CHECK_FUNC([epoll_create], [@%:@include <sys/epoll.h>], [HAVE_EPOLL])
+  PY_CHECK_FUNC([epoll_create1], [@%:@include <sys/epoll.h>])
+fi
+
 PY_CHECK_FUNC([kqueue],[
 #include <sys/types.h>
 #include <sys/event.h>