]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593) (#127631)
authorVictor Stinner <vstinner@python.org>
Thu, 5 Dec 2024 09:59:53 +0000 (10:59 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Dec 2024 09:59:53 +0000 (09:59 +0000)
gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593)

(cherry picked from commit fcbe6ecdb6ed4dd93b2ee144f89a73af755e2634)

Misc/NEWS.d/next/Library/2024-12-04-11-01-16.gh-issue-93312.9sB-Qw.rst [new file with mode: 0644]
Modules/posixmodule.c
configure
configure.ac
pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Library/2024-12-04-11-01-16.gh-issue-93312.9sB-Qw.rst b/Misc/NEWS.d/next/Library/2024-12-04-11-01-16.gh-issue-93312.9sB-Qw.rst
new file mode 100644 (file)
index 0000000..e245fa2
--- /dev/null
@@ -0,0 +1,2 @@
+Include ``<sys/pidfd.h>`` to get ``os.PIDFD_NONBLOCK`` constant. Patch by
+Victor Stinner.
index d5298519b588463bf39a240c2cd9f2198cb21cb5..82078a569881a057e7fc9d29a366c52d8d8ddd7d 100644 (file)
@@ -61,6 +61,9 @@
 
 #include <stdio.h>                // ctermid()
 #include <stdlib.h>               // system()
+#ifdef HAVE_SYS_PIDFD_H
+#  include <sys/pidfd.h>          // PIDFD_NONBLOCK
+#endif
 
 /*
  * A number of APIs are available on macOS from a certain macOS version.
index 241cf8f3d4a57cd4abfb36cc4b3815763024b94c..635e2372e905ff8e6be613bc8b821a591bd18ae5 100755 (executable)
--- a/configure
+++ b/configure
@@ -10822,6 +10822,12 @@ if test "x$ac_cv_header_sys_param_h" = xyes
 then :
   printf "%s\n" "#define HAVE_SYS_PARAM_H 1" >>confdefs.h
 
+fi
+ac_fn_c_check_header_compile "$LINENO" "sys/pidfd.h" "ac_cv_header_sys_pidfd_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_pidfd_h" = xyes
+then :
+  printf "%s\n" "#define HAVE_SYS_PIDFD_H 1" >>confdefs.h
+
 fi
 ac_fn_c_check_header_compile "$LINENO" "sys/poll.h" "ac_cv_header_sys_poll_h" "$ac_includes_default"
 if test "x$ac_cv_header_sys_poll_h" = xyes
index 9270b5f7172d54f079b6fb1ddfecec3a0d027c5e..de9d7f56ffb5718fc3cd1d3e3819e02e3cd009bb 100644 (file)
@@ -2874,7 +2874,7 @@ AC_CHECK_HEADERS([ \
   linux/tipc.h linux/wait.h netdb.h net/ethernet.h netinet/in.h netpacket/packet.h poll.h process.h pthread.h pty.h \
   sched.h setjmp.h shadow.h signal.h spawn.h stropts.h sys/audioio.h sys/bsdtty.h sys/devpoll.h \
   sys/endian.h sys/epoll.h sys/event.h sys/eventfd.h sys/file.h sys/ioctl.h sys/kern_control.h \
-  sys/loadavg.h sys/lock.h sys/memfd.h sys/mkdev.h sys/mman.h sys/modem.h sys/param.h sys/poll.h \
+  sys/loadavg.h sys/lock.h sys/memfd.h sys/mkdev.h sys/mman.h sys/modem.h sys/param.h sys/pidfd.h sys/poll.h \
   sys/random.h sys/resource.h sys/select.h sys/sendfile.h sys/socket.h sys/soundcard.h sys/stat.h \
   sys/statvfs.h sys/sys_domain.h sys/syscall.h sys/sysmacros.h sys/termio.h sys/time.h sys/times.h \
   sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h sys/xattr.h sysexits.h syslog.h \
index 7d3537e5dd8385ba80aae63eee0b266186115666..167c6a11411aa68abb1d3a502ab178de1fc62351 100644 (file)
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 
+/* Define to 1 if you have the <sys/pidfd.h> header file. */
+#undef HAVE_SYS_PIDFD_H
+
 /* Define to 1 if you have the <sys/poll.h> header file. */
 #undef HAVE_SYS_POLL_H