closes bpo-38713: Expose P_PIDFD in os if it's defined. (GH-17071)
https://bugs.python.org/issue38713
This commit is contained in:
parent
6c4c45efae
commit
5c0c325453
|
@ -3921,7 +3921,8 @@ written in Python, such as a mail server's external command delivery program.
|
||||||
.. function:: waitid(idtype, id, options)
|
.. function:: waitid(idtype, id, options)
|
||||||
|
|
||||||
Wait for the completion of one or more child processes.
|
Wait for the completion of one or more child processes.
|
||||||
*idtype* can be :data:`P_PID`, :data:`P_PGID` or :data:`P_ALL`.
|
*idtype* can be :data:`P_PID`, :data:`P_PGID`, :data:`P_ALL`, or
|
||||||
|
:data:`P_PIDFD` on Linux.
|
||||||
*id* specifies the pid to wait on.
|
*id* specifies the pid to wait on.
|
||||||
*options* is constructed from the ORing of one or more of :data:`WEXITED`,
|
*options* is constructed from the ORing of one or more of :data:`WEXITED`,
|
||||||
:data:`WSTOPPED` or :data:`WCONTINUED` and additionally may be ORed with
|
:data:`WSTOPPED` or :data:`WCONTINUED` and additionally may be ORed with
|
||||||
|
@ -3946,6 +3947,15 @@ written in Python, such as a mail server's external command delivery program.
|
||||||
|
|
||||||
.. versionadded:: 3.3
|
.. versionadded:: 3.3
|
||||||
|
|
||||||
|
.. data:: P_PIDFD
|
||||||
|
|
||||||
|
This is a Linux-specific *idtype* that indicates that *id* is a file
|
||||||
|
descriptor that refers to a process.
|
||||||
|
|
||||||
|
.. availability:: Linux 5.4+
|
||||||
|
|
||||||
|
.. versionadded:: 3.9
|
||||||
|
|
||||||
.. data:: WEXITED
|
.. data:: WEXITED
|
||||||
WSTOPPED
|
WSTOPPED
|
||||||
WNOWAIT
|
WNOWAIT
|
||||||
|
|
|
@ -150,8 +150,9 @@ os
|
||||||
Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`.
|
Added :data:`~os.CLD_KILLED` and :data:`~os.CLD_STOPPED` for :attr:`si_code`.
|
||||||
(Contributed by Dong-hee Na in :issue:`38493`.)
|
(Contributed by Dong-hee Na in :issue:`38493`.)
|
||||||
|
|
||||||
Exposed the Linux-specific :func:`os.pidfd_open` for process management with
|
Exposed the Linux-specific :func:`os.pidfd_open` (:issue:`38692`) and
|
||||||
file descriptors. (:issue:`38692`)
|
:data:`os.P_PIDFD` (:issue:`38713`) for process management with file
|
||||||
|
descriptors.
|
||||||
|
|
||||||
threading
|
threading
|
||||||
---------
|
---------
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Add :data:`os.P_PIDFD` constant, which may be passed to :func:`os.waitid` to
|
||||||
|
wait on a Linux process file descriptor.
|
|
@ -85,6 +85,9 @@ corresponding Unix manual entries for more information on calls.");
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h> /* For WNOHANG */
|
#include <sys/wait.h> /* For WNOHANG */
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_LINUX_WAIT_H
|
||||||
|
#include <linux/wait.h> // For P_PIDFD
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SIGNAL_H
|
#ifdef HAVE_SIGNAL_H
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
@ -14099,6 +14102,9 @@ all_ins(PyObject *m)
|
||||||
if (PyModule_AddIntMacro(m, P_PID)) return -1;
|
if (PyModule_AddIntMacro(m, P_PID)) return -1;
|
||||||
if (PyModule_AddIntMacro(m, P_PGID)) return -1;
|
if (PyModule_AddIntMacro(m, P_PGID)) return -1;
|
||||||
if (PyModule_AddIntMacro(m, P_ALL)) return -1;
|
if (PyModule_AddIntMacro(m, P_ALL)) return -1;
|
||||||
|
#ifdef P_PIDFD
|
||||||
|
if (PyModule_AddIntMacro(m, P_PIDFD)) return -1;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifdef WEXITED
|
#ifdef WEXITED
|
||||||
if (PyModule_AddIntMacro(m, WEXITED)) return -1;
|
if (PyModule_AddIntMacro(m, WEXITED)) return -1;
|
||||||
|
|
|
@ -782,6 +782,7 @@ infodir
|
||||||
docdir
|
docdir
|
||||||
oldincludedir
|
oldincludedir
|
||||||
includedir
|
includedir
|
||||||
|
runstatedir
|
||||||
localstatedir
|
localstatedir
|
||||||
sharedstatedir
|
sharedstatedir
|
||||||
sysconfdir
|
sysconfdir
|
||||||
|
@ -895,6 +896,7 @@ datadir='${datarootdir}'
|
||||||
sysconfdir='${prefix}/etc'
|
sysconfdir='${prefix}/etc'
|
||||||
sharedstatedir='${prefix}/com'
|
sharedstatedir='${prefix}/com'
|
||||||
localstatedir='${prefix}/var'
|
localstatedir='${prefix}/var'
|
||||||
|
runstatedir='${localstatedir}/run'
|
||||||
includedir='${prefix}/include'
|
includedir='${prefix}/include'
|
||||||
oldincludedir='/usr/include'
|
oldincludedir='/usr/include'
|
||||||
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
|
||||||
|
@ -1147,6 +1149,15 @@ do
|
||||||
| -silent | --silent | --silen | --sile | --sil)
|
| -silent | --silent | --silen | --sile | --sil)
|
||||||
silent=yes ;;
|
silent=yes ;;
|
||||||
|
|
||||||
|
-runstatedir | --runstatedir | --runstatedi | --runstated \
|
||||||
|
| --runstate | --runstat | --runsta | --runst | --runs \
|
||||||
|
| --run | --ru | --r)
|
||||||
|
ac_prev=runstatedir ;;
|
||||||
|
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
|
||||||
|
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
|
||||||
|
| --run=* | --ru=* | --r=*)
|
||||||
|
runstatedir=$ac_optarg ;;
|
||||||
|
|
||||||
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
|
||||||
ac_prev=sbindir ;;
|
ac_prev=sbindir ;;
|
||||||
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
|
||||||
|
@ -1284,7 +1295,7 @@ fi
|
||||||
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
|
||||||
datadir sysconfdir sharedstatedir localstatedir includedir \
|
datadir sysconfdir sharedstatedir localstatedir includedir \
|
||||||
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
|
||||||
libdir localedir mandir
|
libdir localedir mandir runstatedir
|
||||||
do
|
do
|
||||||
eval ac_val=\$$ac_var
|
eval ac_val=\$$ac_var
|
||||||
# Remove trailing slashes.
|
# Remove trailing slashes.
|
||||||
|
@ -1437,6 +1448,7 @@ Fine tuning of the installation directories:
|
||||||
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
|
||||||
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
|
||||||
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
|
||||||
|
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
|
||||||
--libdir=DIR object code libraries [EPREFIX/lib]
|
--libdir=DIR object code libraries [EPREFIX/lib]
|
||||||
--includedir=DIR C header files [PREFIX/include]
|
--includedir=DIR C header files [PREFIX/include]
|
||||||
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
--oldincludedir=DIR C header files for non-gcc [/usr/include]
|
||||||
|
@ -7917,7 +7929,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.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 pty.h \
|
sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
|
||||||
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
|
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
|
||||||
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
|
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
|
||||||
sys/endian.h sys/sysmacros.h linux/memfd.h sys/memfd.h sys/mman.h
|
sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
|
|
|
@ -2161,7 +2161,7 @@ sys/stat.h sys/syscall.h sys/sys_domain.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 pty.h \
|
sys/times.h sys/types.h sys/uio.h sys/un.h sys/utsname.h sys/wait.h pty.h \
|
||||||
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
|
libutil.h sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \
|
||||||
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
|
linux/tipc.h linux/random.h spawn.h util.h alloca.h endian.h \
|
||||||
sys/endian.h sys/sysmacros.h linux/memfd.h sys/memfd.h sys/mman.h)
|
sys/endian.h sys/sysmacros.h linux/memfd.h linux/wait.h sys/memfd.h sys/mman.h)
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_HEADER_MAJOR
|
AC_HEADER_MAJOR
|
||||||
|
|
||||||
|
|
|
@ -642,6 +642,9 @@
|
||||||
/* Define to 1 if you have the <linux/vm_sockets.h> header file. */
|
/* Define to 1 if you have the <linux/vm_sockets.h> header file. */
|
||||||
#undef HAVE_LINUX_VM_SOCKETS_H
|
#undef HAVE_LINUX_VM_SOCKETS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <linux/wait.h> header file. */
|
||||||
|
#undef HAVE_LINUX_WAIT_H
|
||||||
|
|
||||||
/* Define to 1 if you have the `lockf' function. */
|
/* Define to 1 if you have the `lockf' function. */
|
||||||
#undef HAVE_LOCKF
|
#undef HAVE_LOCKF
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue