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.
#define HAVE_GETPEERNAME
#endif
+/* Define if you have the getpgid function. */
+#undef HAVE_GETPGID
+
/* Define if you have the getpgrp function. */
#undef HAVE_GETPGRP
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.
}
#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\
#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 */
/* 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
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 \
# 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 \
/* 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