diff -r 534a936e0f24 Modules/signalmodule.c --- a/Modules/signalmodule.c Mon Oct 29 20:59:27 2007 +0100 +++ b/Modules/signalmodule.c Mon Oct 29 21:25:05 2007 +0100 @@ -263,6 +263,36 @@ None -- if an unknown handler is in effe None -- if an unknown handler is in effect\n\ anything else -- the callable Python object used as a handler"); +#ifdef HAVE_SIGINTERRUPT +PyDoc_STRVAR(siginterrupt_doc, +"siginterrupt(sig, flag) -> None\n\ +change system call restart behaviour: if flag is False, system calls\n\ +will be restarted when interrupted by signal sig, else system calls\n\ +will be interrupted."); + +static PyObject * +signal_siginterrupt(PyObject *self, PyObject *args) +{ + int sig_num; + int flag; + + if (!PyArg_ParseTuple(args, "ii:siginterrupt", &sig_num, &flag)) + return NULL; + if (sig_num < 1 || sig_num >= NSIG) { + PyErr_SetString(PyExc_ValueError, + "signal number out of range"); + return NULL; + } + if (siginterrupt(sig_num, flag)<0) { + PyErr_SetFromErrno(PyExc_RuntimeError); + return NULL; + } + + Py_INCREF(Py_None); + return Py_None; +} + +#endif /* List of functions defined in the module */ static PyMethodDef signal_methods[] = { @@ -271,6 +301,9 @@ static PyMethodDef signal_methods[] = { #endif {"signal", signal_signal, METH_VARARGS, signal_doc}, {"getsignal", signal_getsignal, METH_VARARGS, getsignal_doc}, +#ifdef HAVE_SIGINTERRUPT + {"siginterrupt", signal_siginterrupt, METH_VARARGS, siginterrupt_doc}, +#endif #ifdef HAVE_PAUSE {"pause", (PyCFunction)signal_pause, METH_NOARGS,pause_doc},