summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2010-03-14 06:49:55 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2010-03-14 06:49:55 (GMT)
commitfb94c5f1e5bb9ccd28bcd311f388db7bea35c865 (patch)
tree7d32df9daaf77314889d2537330055c5ed01245b /Python
parentdddd5e909895508b67b92156bc13ba68329d0d24 (diff)
downloadcpython-fb94c5f1e5bb9ccd28bcd311f388db7bea35c865.zip
cpython-fb94c5f1e5bb9ccd28bcd311f388db7bea35c865.tar.gz
cpython-fb94c5f1e5bb9ccd28bcd311f388db7bea35c865.tar.bz2
* Replaces the internals of the subprocess module from fork through exec on
POSIX systems with a C extension module. This is required in order for the subprocess module to be made thread safe. The pure python implementation is retained so that it can continue to be used if for some reason the _posixsubprocess extension module is not available. The unittest executes tests on both code paths to guarantee compatibility. * Moves PyLong_FromPid and PyLong_AsPid from posixmodule.c into longobject.h. Code reviewed by jeffrey.yasskin at http://codereview.appspot.com/223077/show
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index cfa19b0..2bdef98 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -2130,6 +2130,27 @@ initsigs(void)
}
+/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL.
+ *
+ * All of the code in this function must only use async-signal-safe functions,
+ * listed at `man 7 signal` or
+ * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
+ */
+void
+_Py_RestoreSignals(void)
+{
+#ifdef SIGPIPE
+ PyOS_setsig(SIGPIPE, SIG_DFL);
+#endif
+#ifdef SIGXFZ
+ PyOS_setsig(SIGXFZ, SIG_DFL);
+#endif
+#ifdef SIGXFSZ
+ PyOS_setsig(SIGXFSZ, SIG_DFL);
+#endif
+}
+
+
/*
* The file descriptor fd is considered ``interactive'' if either
* a) isatty(fd) is TRUE, or
@@ -2223,6 +2244,11 @@ PyOS_getsig(int sig)
#endif
}
+/*
+ * All of the code in this function must only use async-signal-safe functions,
+ * listed at `man 7 signal` or
+ * http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html.
+ */
PyOS_sighandler_t
PyOS_setsig(int sig, PyOS_sighandler_t handler)
{