summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Doc/lib/libos.tex6
-rw-r--r--Mac/Include/pyconfig.h3
-rw-r--r--Misc/NEWS3
-rw-r--r--Modules/posixmodule.c22
-rw-r--r--RISCOS/pyconfig.h3
-rwxr-xr-xconfigure2
-rw-r--r--configure.in2
-rw-r--r--pyconfig.h.in3
8 files changed, 41 insertions, 3 deletions
diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex
index c02d6a6..ebc3c5c 100644
--- a/Doc/lib/libos.tex
+++ b/Doc/lib/libos.tex
@@ -144,6 +144,12 @@ are multiple login names which map to the same user id.
Availability: \UNIX.
\end{funcdesc}
+\begin{funcdesc}{getpgid}{pid}
+Return the process group id of the process with process id \var{pid}.
+If \var{pid} is 0, the process group id of the current process is
+returned. Availability: \UNIX.
+\end{funcdesc}
+
\begin{funcdesc}{getpgrp}{}
\index{process!group}
Return the id of the current process group.
diff --git a/Mac/Include/pyconfig.h b/Mac/Include/pyconfig.h
index 2229df4..38542d7 100644
--- a/Mac/Include/pyconfig.h
+++ b/Mac/Include/pyconfig.h
@@ -451,6 +451,9 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define HAVE_GETPEERNAME
#endif
+/* Define if you have the getpgid function. */
+#undef HAVE_GETPGID
+
/* Define if you have the getpgrp function. */
#undef HAVE_GETPGRP
diff --git a/Misc/NEWS b/Misc/NEWS
index 767c3a5..383614f 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -114,7 +114,8 @@ Extension modules
This will create a temporary in-memory bsddb that won't be
written to disk.
-- posix.killpg and posix.mknod have been added where available.
+- posix.killpg, posix.mknod, and posix.getpgid have been added where
+ available.
- The locale module now exposes the C library's gettext interface.
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 7e90fbc..a7a7ddd 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2117,6 +2117,25 @@ posix_getgroups(PyObject *self, PyObject *args)
}
#endif
+#ifdef HAVE_GETPGID
+static char posix_getpgid__doc__[] =
+"getpgid(pid) -> pgid\n\
+Call the system call getpgid().";
+
+static PyObject *
+posix_getpgid(PyObject *self, PyObject *args)
+{
+ int pid, pgid;
+ if (!PyArg_ParseTuple(args, "i:getpgid", &pid))
+ return NULL;
+ pgid = getpgid(pid);
+ if (pgid < 0)
+ return posix_error();
+ return PyInt_FromLong((long)pgid);
+}
+#endif /* HAVE_GETPGID */
+
+
#ifdef HAVE_GETPGRP
PyDoc_STRVAR(posix_getpgrp__doc__,
"getpgrp() -> pgrp\n\
@@ -6406,6 +6425,9 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_SETGROUPS
{"setgroups", posix_setgroups, METH_VARARGS, posix_setgroups__doc__},
#endif /* HAVE_SETGROUPS */
+#ifdef HAVE_GETPGID
+ {"getpgid", posix_getpgid, METH_VARARGS, posix_getpgid__doc__},
+#endif /* HAVE_GETPGID */
#ifdef HAVE_SETPGRP
{"setpgrp", posix_setpgrp, METH_VARARGS, posix_setpgrp__doc__},
#endif /* HAVE_SETPGRP */
diff --git a/RISCOS/pyconfig.h b/RISCOS/pyconfig.h
index 12f8fc6..a8cc8c7 100644
--- a/RISCOS/pyconfig.h
+++ b/RISCOS/pyconfig.h
@@ -404,6 +404,9 @@
/* Define if you have the getpeername function. */
#undef HAVE_GETPEERNAME
+/* Define if you have the getpgid function. */
+#undef HAVE_GETPGID
+
/* Define if you have the getpgrp function. */
#undef HAVE_GETPGRP
diff --git a/configure b/configure
index 92bf5f6..d35b169 100755
--- a/configure
+++ b/configure
@@ -11449,7 +11449,7 @@ echo "${ECHO_T}MACHDEP_OBJS" >&6
for ac_func in alarm chown chroot clock confstr ctermid ctermid_r execv \
fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
- gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
+ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \
hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \
nice pathconf pause plock poll pthread_init \
putenv readlink \
diff --git a/configure.in b/configure.in
index 88025bc..35b890d 100644
--- a/configure.in
+++ b/configure.in
@@ -1621,7 +1621,7 @@ AC_MSG_RESULT(MACHDEP_OBJS)
# checks for library functions
AC_CHECK_FUNCS(alarm chown chroot clock confstr ctermid ctermid_r execv \
fchdir flock fork fsync fdatasync fpathconf ftime ftruncate \
- gai_strerror getgroups getlogin getpeername getpid getpwent getwd \
+ gai_strerror getgroups getlogin getpeername getpgid getpid getpwent getwd \
hstrerror inet_pton kill killpg link lstat mkfifo mknod mktime mremap \
nice pathconf pause plock poll pthread_init \
putenv readlink \
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 87b79ae..0606962 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -176,6 +176,9 @@
/* Define to 1 if you have the `getpeername' function. */
#undef HAVE_GETPEERNAME
+/* Define to 1 if you have the `getpgid' function. */
+#undef HAVE_GETPGID
+
/* Define to 1 if you have the `getpgrp' function. */
#undef HAVE_GETPGRP