#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
# include "pycore_gc.h"
# include "pycore_runtime.h"
#endif
#include "pycore_modsupport.h"
PyDoc_STRVAR(signal_default_int_handler__doc__,
"default_int_handler($module, signalnum, frame, /)\n"
"--\n"
"\n"
"The default handler for SIGINT installed by Python.\n"
"\n"
"It raises KeyboardInterrupt.");
#define SIGNAL_DEFAULT_INT_HANDLER_METHODDEF …
static PyObject *
signal_default_int_handler_impl(PyObject *module, int signalnum,
PyObject *frame);
static PyObject *
signal_default_int_handler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#if defined(HAVE_ALARM)
PyDoc_STRVAR(signal_alarm__doc__,
"alarm($module, seconds, /)\n"
"--\n"
"\n"
"Arrange for SIGALRM to arrive after the given number of seconds.");
#define SIGNAL_ALARM_METHODDEF …
static long
signal_alarm_impl(PyObject *module, int seconds);
static PyObject *
signal_alarm(PyObject *module, PyObject *arg)
{ … }
#endif
#if defined(HAVE_PAUSE)
PyDoc_STRVAR(signal_pause__doc__,
"pause($module, /)\n"
"--\n"
"\n"
"Wait until a signal arrives.");
#define SIGNAL_PAUSE_METHODDEF …
static PyObject *
signal_pause_impl(PyObject *module);
static PyObject *
signal_pause(PyObject *module, PyObject *Py_UNUSED(ignored))
{ … }
#endif
PyDoc_STRVAR(signal_raise_signal__doc__,
"raise_signal($module, signalnum, /)\n"
"--\n"
"\n"
"Send a signal to the executing process.");
#define SIGNAL_RAISE_SIGNAL_METHODDEF …
static PyObject *
signal_raise_signal_impl(PyObject *module, int signalnum);
static PyObject *
signal_raise_signal(PyObject *module, PyObject *arg)
{ … }
PyDoc_STRVAR(signal_signal__doc__,
"signal($module, signalnum, handler, /)\n"
"--\n"
"\n"
"Set the action for the given signal.\n"
"\n"
"The action can be SIG_DFL, SIG_IGN, or a callable Python object.\n"
"The previous action is returned. See getsignal() for possible return values.\n"
"\n"
"*** IMPORTANT NOTICE ***\n"
"A signal handler function is called with two arguments:\n"
"the first is the signal number, the second is the interrupted stack frame.");
#define SIGNAL_SIGNAL_METHODDEF …
static PyObject *
signal_signal_impl(PyObject *module, int signalnum, PyObject *handler);
static PyObject *
signal_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
PyDoc_STRVAR(signal_getsignal__doc__,
"getsignal($module, signalnum, /)\n"
"--\n"
"\n"
"Return the current action for the given signal.\n"
"\n"
"The return value can be:\n"
" SIG_IGN -- if the signal is being ignored\n"
" SIG_DFL -- if the default action for the signal is in effect\n"
" None -- if an unknown handler is in effect\n"
" anything else -- the callable Python object used as a handler");
#define SIGNAL_GETSIGNAL_METHODDEF …
static PyObject *
signal_getsignal_impl(PyObject *module, int signalnum);
static PyObject *
signal_getsignal(PyObject *module, PyObject *arg)
{ … }
PyDoc_STRVAR(signal_strsignal__doc__,
"strsignal($module, signalnum, /)\n"
"--\n"
"\n"
"Return the system description of the given signal.\n"
"\n"
"Returns the description of signal *signalnum*, such as \"Interrupt\"\n"
"for :const:`SIGINT`. Returns :const:`None` if *signalnum* has no\n"
"description. Raises :exc:`ValueError` if *signalnum* is invalid.");
#define SIGNAL_STRSIGNAL_METHODDEF …
static PyObject *
signal_strsignal_impl(PyObject *module, int signalnum);
static PyObject *
signal_strsignal(PyObject *module, PyObject *arg)
{ … }
#if defined(HAVE_SIGINTERRUPT)
PyDoc_STRVAR(signal_siginterrupt__doc__,
"siginterrupt($module, signalnum, flag, /)\n"
"--\n"
"\n"
"Change system call restart behaviour.\n"
"\n"
"If flag is False, system calls will be restarted when interrupted by\n"
"signal sig, else system calls will be interrupted.");
#define SIGNAL_SIGINTERRUPT_METHODDEF …
static PyObject *
signal_siginterrupt_impl(PyObject *module, int signalnum, int flag);
static PyObject *
signal_siginterrupt(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#endif
PyDoc_STRVAR(signal_set_wakeup_fd__doc__,
"set_wakeup_fd($module, fd, /, *, warn_on_full_buffer=True)\n"
"--\n"
"\n"
"Sets the fd to be written to (with the signal number) when a signal comes in.\n"
"\n"
"A library can use this to wakeup select or poll.\n"
"The previous fd or -1 is returned.\n"
"\n"
"The fd must be non-blocking.");
#define SIGNAL_SET_WAKEUP_FD_METHODDEF …
static PyObject *
signal_set_wakeup_fd_impl(PyObject *module, PyObject *fdobj,
int warn_on_full_buffer);
static PyObject *
signal_set_wakeup_fd(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{ … }
#if defined(HAVE_SETITIMER)
PyDoc_STRVAR(signal_setitimer__doc__,
"setitimer($module, which, seconds, interval=0.0, /)\n"
"--\n"
"\n"
"Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL or ITIMER_PROF).\n"
"\n"
"The timer will fire after value seconds and after that every interval seconds.\n"
"The itimer can be cleared by setting seconds to zero.\n"
"\n"
"Returns old values as a tuple: (delay, interval).");
#define SIGNAL_SETITIMER_METHODDEF …
static PyObject *
signal_setitimer_impl(PyObject *module, int which, PyObject *seconds,
PyObject *interval);
static PyObject *
signal_setitimer(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#endif
#if defined(HAVE_GETITIMER)
PyDoc_STRVAR(signal_getitimer__doc__,
"getitimer($module, which, /)\n"
"--\n"
"\n"
"Returns current value of given itimer.");
#define SIGNAL_GETITIMER_METHODDEF …
static PyObject *
signal_getitimer_impl(PyObject *module, int which);
static PyObject *
signal_getitimer(PyObject *module, PyObject *arg)
{ … }
#endif
#if defined(HAVE_SIGSET_T) && defined(PYPTHREAD_SIGMASK)
PyDoc_STRVAR(signal_pthread_sigmask__doc__,
"pthread_sigmask($module, how, mask, /)\n"
"--\n"
"\n"
"Fetch and/or change the signal mask of the calling thread.");
#define SIGNAL_PTHREAD_SIGMASK_METHODDEF …
static PyObject *
signal_pthread_sigmask_impl(PyObject *module, int how, sigset_t mask);
static PyObject *
signal_pthread_sigmask(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#endif
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGPENDING)
PyDoc_STRVAR(signal_sigpending__doc__,
"sigpending($module, /)\n"
"--\n"
"\n"
"Examine pending signals.\n"
"\n"
"Returns a set of signal numbers that are pending for delivery to\n"
"the calling thread.");
#define SIGNAL_SIGPENDING_METHODDEF …
static PyObject *
signal_sigpending_impl(PyObject *module);
static PyObject *
signal_sigpending(PyObject *module, PyObject *Py_UNUSED(ignored))
{ … }
#endif
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAIT)
PyDoc_STRVAR(signal_sigwait__doc__,
"sigwait($module, sigset, /)\n"
"--\n"
"\n"
"Wait for a signal.\n"
"\n"
"Suspend execution of the calling thread until the delivery of one of the\n"
"signals specified in the signal set sigset. The function accepts the signal\n"
"and returns the signal number.");
#define SIGNAL_SIGWAIT_METHODDEF …
static PyObject *
signal_sigwait_impl(PyObject *module, sigset_t sigset);
static PyObject *
signal_sigwait(PyObject *module, PyObject *arg)
{ … }
#endif
#if ((defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS))
PyDoc_STRVAR(signal_valid_signals__doc__,
"valid_signals($module, /)\n"
"--\n"
"\n"
"Return a set of valid signal numbers on this platform.\n"
"\n"
"The signal numbers returned by this function can be safely passed to\n"
"functions like `pthread_sigmask`.");
#define SIGNAL_VALID_SIGNALS_METHODDEF …
static PyObject *
signal_valid_signals_impl(PyObject *module);
static PyObject *
signal_valid_signals(PyObject *module, PyObject *Py_UNUSED(ignored))
{ … }
#endif
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGWAITINFO)
PyDoc_STRVAR(signal_sigwaitinfo__doc__,
"sigwaitinfo($module, sigset, /)\n"
"--\n"
"\n"
"Wait synchronously until one of the signals in *sigset* is delivered.\n"
"\n"
"Returns a struct_siginfo containing information about the signal.");
#define SIGNAL_SIGWAITINFO_METHODDEF …
static PyObject *
signal_sigwaitinfo_impl(PyObject *module, sigset_t sigset);
static PyObject *
signal_sigwaitinfo(PyObject *module, PyObject *arg)
{ … }
#endif
#if defined(HAVE_SIGSET_T) && defined(HAVE_SIGTIMEDWAIT)
PyDoc_STRVAR(signal_sigtimedwait__doc__,
"sigtimedwait($module, sigset, timeout, /)\n"
"--\n"
"\n"
"Like sigwaitinfo(), but with a timeout.\n"
"\n"
"The timeout is specified in seconds, with floating-point numbers allowed.");
#define SIGNAL_SIGTIMEDWAIT_METHODDEF …
static PyObject *
signal_sigtimedwait_impl(PyObject *module, sigset_t sigset,
PyObject *timeout_obj);
static PyObject *
signal_sigtimedwait(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#endif
#if defined(HAVE_PTHREAD_KILL)
PyDoc_STRVAR(signal_pthread_kill__doc__,
"pthread_kill($module, thread_id, signalnum, /)\n"
"--\n"
"\n"
"Send a signal to a thread.");
#define SIGNAL_PTHREAD_KILL_METHODDEF …
static PyObject *
signal_pthread_kill_impl(PyObject *module, unsigned long thread_id,
int signalnum);
static PyObject *
signal_pthread_kill(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#endif
#if (defined(__linux__) && defined(__NR_pidfd_send_signal) && !(defined(__ANDROID__) && __ANDROID_API__ < 31))
PyDoc_STRVAR(signal_pidfd_send_signal__doc__,
"pidfd_send_signal($module, pidfd, signalnum, siginfo=None, flags=0, /)\n"
"--\n"
"\n"
"Send a signal to a process referred to by a pid file descriptor.");
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF …
static PyObject *
signal_pidfd_send_signal_impl(PyObject *module, int pidfd, int signalnum,
PyObject *siginfo, int flags);
static PyObject *
signal_pidfd_send_signal(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{ … }
#endif
#ifndef SIGNAL_ALARM_METHODDEF
#define SIGNAL_ALARM_METHODDEF
#endif
#ifndef SIGNAL_PAUSE_METHODDEF
#define SIGNAL_PAUSE_METHODDEF
#endif
#ifndef SIGNAL_SIGINTERRUPT_METHODDEF
#define SIGNAL_SIGINTERRUPT_METHODDEF
#endif
#ifndef SIGNAL_SETITIMER_METHODDEF
#define SIGNAL_SETITIMER_METHODDEF
#endif
#ifndef SIGNAL_GETITIMER_METHODDEF
#define SIGNAL_GETITIMER_METHODDEF
#endif
#ifndef SIGNAL_PTHREAD_SIGMASK_METHODDEF
#define SIGNAL_PTHREAD_SIGMASK_METHODDEF
#endif
#ifndef SIGNAL_SIGPENDING_METHODDEF
#define SIGNAL_SIGPENDING_METHODDEF
#endif
#ifndef SIGNAL_SIGWAIT_METHODDEF
#define SIGNAL_SIGWAIT_METHODDEF
#endif
#ifndef SIGNAL_VALID_SIGNALS_METHODDEF
#define SIGNAL_VALID_SIGNALS_METHODDEF
#endif
#ifndef SIGNAL_SIGWAITINFO_METHODDEF
#define SIGNAL_SIGWAITINFO_METHODDEF
#endif
#ifndef SIGNAL_SIGTIMEDWAIT_METHODDEF
#define SIGNAL_SIGTIMEDWAIT_METHODDEF
#endif
#ifndef SIGNAL_PTHREAD_KILL_METHODDEF
#define SIGNAL_PTHREAD_KILL_METHODDEF
#endif
#ifndef SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#define SIGNAL_PIDFD_SEND_SIGNAL_METHODDEF
#endif