\end{funcdesc}
\begin{funcdesc}{isatty}{fd}
-Return \code{1} if the file descriptor \var{fd} is open and connected to a
-tty(-like) device, else \code{0}.
+Return \code{True} if the file descriptor \var{fd} is open and
+connected to a tty(-like) device, else \code{False}.
Availability: \UNIX.
\end{funcdesc}
Availability: \UNIX.
\end{datadesc}
+\begin{datadesc}{WCONTINUED}
+This option causes child processes to be reported if they have been
+continued from a job control stop since their status was last
+reported.
+Availability: Some \UNIX{} systems.
+\versionadded{2.3}
+\end{datadesc}
+
+\begin{datadesc}{WUNTRACED}
+This option causes child processes to be reported if they have been
+stopped but their current state has not been reported since they were
+stopped.
+Availability: \UNIX.
+\versionadded{2.3}
+\end{datadesc}
+
The following functions take a process status code as returned by
\function{system()}, \function{wait()}, or \function{waitpid()} as a
parameter. They may be used to determine the disposition of a
process.
+\begin{funcdesc}{WCOREDUMP}{status}
+Returns \code{True} if a core dump was generated for the process,
+otherwise it returns \code{False}.
+Availability: \UNIX.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{WIFCONTINUED}{status}
+Returns \code{True} if the process has been continued from a job
+control stop, otherwise it returns \code{False}.
+Availability: \UNIX.
+\versionadded{2.3}
+\end{funcdesc}
+
\begin{funcdesc}{WIFSTOPPED}{status}
-Return true if the process has been stopped.
+Returns \code{True} if the process has been stopped, otherwise it
+returns \code{False}.
Availability: \UNIX.
\end{funcdesc}
\begin{funcdesc}{WIFSIGNALED}{status}
-Return true if the process exited due to a signal.
+Returns \code{True} if the process exited due to a signal, otherwise
+it returns \code{False}.
Availability: \UNIX.
\end{funcdesc}
\begin{funcdesc}{WIFEXITED}{status}
-Return true if the process exited using the \manpage{exit}{2} system
-call.
+Returns \code{True} if the process exited using the \manpage{exit}{2}
+system call, otherwise it returns \code{False}.
Availability: \UNIX.
\end{funcdesc}
}
static char posix_isatty__doc__[] =
-"isatty(fd) -> Boolean\n\
-Return true if the file descriptor 'fd' is an open file descriptor\n\
+"isatty(fd) -> bool\n\
+Return True if the file descriptor 'fd' is an open file descriptor\n\
connected to the slave end of a terminal.";
static PyObject *
int fd;
if (!PyArg_ParseTuple(args, "i:isatty", &fd))
return NULL;
- return Py_BuildValue("i", isatty(fd));
+ return PyBool_FromLong(isatty(fd));
}
#ifdef HAVE_PIPE
#ifdef HAVE_SYS_WAIT_H
+#ifdef WCOREDUMP
+static char posix_WCOREDUMP__doc__[] =
+"WCOREDUMP(status) -> bool\n\
+Return True if the process returning 'status' was dumped to a core file.";
+
+static PyObject *
+posix_WCOREDUMP(PyObject *self, PyObject *args)
+{
+#ifdef UNION_WAIT
+ union wait status;
+#define status_i (status.w_status)
+#else
+ int status;
+#define status_i status
+#endif
+ status_i = 0;
+
+ if (!PyArg_ParseTuple(args, "i:WCOREDUMP", &status_i))
+ {
+ return NULL;
+ }
+
+ return PyBool_FromLong(WCOREDUMP(status));
+#undef status_i
+}
+#endif /* WCOREDUMP */
+
+#ifdef WIFCONTINUED
+static char posix_WIFCONTINUED__doc__[] =
+"WIFCONTINUED(status) -> bool\n\
+Return True if the process returning 'status' was continued from a\n\
+job control stop.";
+
+static PyObject *
+posix_WCONTINUED(PyObject *self, PyObject *args)
+{
+#ifdef UNION_WAIT
+ union wait status;
+#define status_i (status.w_status)
+#else
+ int status;
+#define status_i status
+#endif
+ status_i = 0;
+
+ if (!PyArg_ParseTuple(args, "i:WCONTINUED", &status_i))
+ {
+ return NULL;
+ }
+
+ return PyBool_FromLong(WCONTINUED(status));
+#undef status_i
+}
+#endif /* WIFCONTINUED */
+
#ifdef WIFSTOPPED
static char posix_WIFSTOPPED__doc__[] =
-"WIFSTOPPED(status) -> Boolean\n\
-Return true if the process returning 'status' was stopped.";
+"WIFSTOPPED(status) -> bool\n\
+Return True if the process returning 'status' was stopped.";
static PyObject *
posix_WIFSTOPPED(PyObject *self, PyObject *args)
return NULL;
}
- return Py_BuildValue("i", WIFSTOPPED(status));
+ return PyBool_FromLong(WIFSTOPPED(status));
#undef status_i
}
#endif /* WIFSTOPPED */
#ifdef WIFSIGNALED
static char posix_WIFSIGNALED__doc__[] =
-"WIFSIGNALED(status) -> Boolean\n\
-Return true if the process returning 'status' was terminated by a signal.";
+"WIFSIGNALED(status) -> bool\n\
+Return True if the process returning 'status' was terminated by a signal.";
static PyObject *
posix_WIFSIGNALED(PyObject *self, PyObject *args)
return NULL;
}
- return Py_BuildValue("i", WIFSIGNALED(status));
+ return PyBool_FromLong(WIFSIGNALED(status));
#undef status_i
}
#endif /* WIFSIGNALED */
#ifdef WIFEXITED
static char posix_WIFEXITED__doc__[] =
-"WIFEXITED(status) -> Boolean\n\
+"WIFEXITED(status) -> bool\n\
Return true if the process returning 'status' exited using the exit()\n\
system call.";
return NULL;
}
- return Py_BuildValue("i", WIFEXITED(status));
+ return PyBool_FromLong(WIFEXITED(status));
#undef status_i
}
#endif /* WIFEXITED */
{"fdatasync", posix_fdatasync, METH_O, posix_fdatasync__doc__},
#endif
#ifdef HAVE_SYS_WAIT_H
+#ifdef WCOREDUMP
+ {"WCOREDUMP", posix_WCOREDUMP, METH_VARARGS, posix_WCOREDUMP__doc__},
+#endif /* WCOREDUMP */
#ifdef WIFSTOPPED
{"WIFSTOPPED", posix_WIFSTOPPED, METH_VARARGS, posix_WIFSTOPPED__doc__},
#endif /* WIFSTOPPED */
#ifdef TMP_MAX
if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1;
#endif
+#ifdef WCONTINUED
+ if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1;
+#endif
#ifdef WNOHANG
if (ins(d, "WNOHANG", (long)WNOHANG)) return -1;
#endif
+#ifdef WUNTRACED
+ if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1;
+#endif
#ifdef O_RDONLY
if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1;
#endif