mirror of https://github.com/python/cpython
gh-123014: Disable pidfd API on older Android versions (#124458)
This commit is contained in:
parent
461c12b438
commit
c58c572a65
|
@ -4602,7 +4602,7 @@ written in Python, such as a mail server's external command delivery program.
|
||||||
|
|
||||||
See the :manpage:`pidfd_open(2)` man page for more details.
|
See the :manpage:`pidfd_open(2)` man page for more details.
|
||||||
|
|
||||||
.. availability:: Linux >= 5.3
|
.. availability:: Linux >= 5.3, Android >= :func:`build-time <sys.getandroidapilevel>` API level 31
|
||||||
.. versionadded:: 3.9
|
.. versionadded:: 3.9
|
||||||
|
|
||||||
.. data:: PIDFD_NONBLOCK
|
.. data:: PIDFD_NONBLOCK
|
||||||
|
|
|
@ -411,7 +411,7 @@ The :mod:`signal` module defines the following functions:
|
||||||
|
|
||||||
See the :manpage:`pidfd_send_signal(2)` man page for more information.
|
See the :manpage:`pidfd_send_signal(2)` man page for more information.
|
||||||
|
|
||||||
.. availability:: Linux >= 5.1
|
.. availability:: Linux >= 5.1, Android >= :func:`build-time <sys.getandroidapilevel>` API level 31
|
||||||
.. versionadded:: 3.9
|
.. versionadded:: 3.9
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
:func:`os.pidfd_open` and :func:`signal.pidfd_send_signal` are now
|
||||||
|
unavailable when building against Android API levels older than 31, since
|
||||||
|
the underlying system calls may cause a crash.
|
|
@ -5954,7 +5954,7 @@ os_wait(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
|
|
||||||
#endif /* defined(HAVE_WAIT) */
|
#endif /* defined(HAVE_WAIT) */
|
||||||
|
|
||||||
#if (defined(__linux__) && defined(__NR_pidfd_open))
|
#if (defined(__linux__) && defined(__NR_pidfd_open) && !(defined(__ANDROID__) && __ANDROID_API__ < 31))
|
||||||
|
|
||||||
PyDoc_STRVAR(os_pidfd_open__doc__,
|
PyDoc_STRVAR(os_pidfd_open__doc__,
|
||||||
"pidfd_open($module, /, pid, flags=0)\n"
|
"pidfd_open($module, /, pid, flags=0)\n"
|
||||||
|
@ -6013,7 +6013,7 @@ exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (defined(__linux__) && defined(__NR_pidfd_open)) */
|
#endif /* (defined(__linux__) && defined(__NR_pidfd_open) && !(defined(__ANDROID__) && __ANDROID_API__ < 31)) */
|
||||||
|
|
||||||
#if defined(HAVE_SETNS)
|
#if defined(HAVE_SETNS)
|
||||||
|
|
||||||
|
@ -12837,4 +12837,4 @@ os__create_environ(PyObject *module, PyObject *Py_UNUSED(ignored))
|
||||||
#ifndef OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
#ifndef OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||||
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
#define OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF
|
||||||
#endif /* !defined(OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF) */
|
#endif /* !defined(OS__SUPPORTS_VIRTUAL_TERMINAL_METHODDEF) */
|
||||||
/*[clinic end generated code: output=a736ad3f7205176e input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=b93bbaaa8eb5b0ce input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -670,7 +670,7 @@ exit:
|
||||||
|
|
||||||
#endif /* defined(HAVE_PTHREAD_KILL) */
|
#endif /* defined(HAVE_PTHREAD_KILL) */
|
||||||
|
|
||||||
#if (defined(__linux__) && defined(__NR_pidfd_send_signal))
|
#if (defined(__linux__) && defined(__NR_pidfd_send_signal) && !(defined(__ANDROID__) && __ANDROID_API__ < 31))
|
||||||
|
|
||||||
PyDoc_STRVAR(signal_pidfd_send_signal__doc__,
|
PyDoc_STRVAR(signal_pidfd_send_signal__doc__,
|
||||||
"pidfd_send_signal($module, pidfd, signalnum, siginfo=None, flags=0, /)\n"
|
"pidfd_send_signal($module, pidfd, signalnum, siginfo=None, flags=0, /)\n"
|
||||||
|
@ -723,7 +723,7 @@ exit:
|
||||||
return return_value;
|
return return_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (defined(__linux__) && defined(__NR_pidfd_send_signal)) */
|
#endif /* (defined(__linux__) && defined(__NR_pidfd_send_signal) && !(defined(__ANDROID__) && __ANDROID_API__ < 31)) */
|
||||||
|
|
||||||
#ifndef SIGNAL_ALARM_METHODDEF
|
#ifndef SIGNAL_ALARM_METHODDEF
|
||||||
#define SIGNAL_ALARM_METHODDEF
|
#define SIGNAL_ALARM_METHODDEF
|
||||||
|
@ -776,4 +776,4 @@ exit:
|
||||||
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
|
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
|
||||||
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
|
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
|
||||||
#endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
|
#endif /* !defined(SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF) */
|
||||||
/*[clinic end generated code: output=6d8e17a32cef668f input=a9049054013a1b77]*/
|
/*[clinic end generated code: output=c57b4b98fad6f4b8 input=a9049054013a1b77]*/
|
||||||
|
|
|
@ -10121,7 +10121,10 @@ os_wait_impl(PyObject *module)
|
||||||
}
|
}
|
||||||
#endif /* HAVE_WAIT */
|
#endif /* HAVE_WAIT */
|
||||||
|
|
||||||
#if defined(__linux__) && defined(__NR_pidfd_open)
|
|
||||||
|
// This system call always crashes on older Android versions.
|
||||||
|
#if defined(__linux__) && defined(__NR_pidfd_open) && \
|
||||||
|
!(defined(__ANDROID__) && __ANDROID_API__ < 31)
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
os.pidfd_open
|
os.pidfd_open
|
||||||
pid: pid_t
|
pid: pid_t
|
||||||
|
|
|
@ -1299,7 +1299,9 @@ signal_pthread_kill_impl(PyObject *module, unsigned long thread_id,
|
||||||
#endif /* #if defined(HAVE_PTHREAD_KILL) */
|
#endif /* #if defined(HAVE_PTHREAD_KILL) */
|
||||||
|
|
||||||
|
|
||||||
#if defined(__linux__) && defined(__NR_pidfd_send_signal)
|
// This system call always crashes on older Android versions.
|
||||||
|
#if defined(__linux__) && defined(__NR_pidfd_send_signal) && \
|
||||||
|
!(defined(__ANDROID__) && __ANDROID_API__ < 31)
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
signal.pidfd_send_signal
|
signal.pidfd_send_signal
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue