]> granicus.if.org Git - python/commitdiff
Patch #568235: Add posix.setpgid.
authorMartin v. Löwis <martin@v.loewis.de>
Thu, 13 Jun 2002 21:09:11 +0000 (21:09 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Thu, 13 Jun 2002 21:09:11 +0000 (21:09 +0000)
Doc/lib/libos.tex
Mac/Include/pyconfig.h
Misc/NEWS
Modules/posixmodule.c
RISCOS/pyconfig.h
configure
configure.in
pyconfig.h.in

index c02d6a6e5dd6a11a35f61ad95a9c31cf0dcb1292..ebc3c5c254bef0fb64818d119e3ffaf92273ca10 100644 (file)
@@ -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.
index 2229df4f0e2908e133dc0b5d71ea1d45a7a0287b..38542d7a746ef4831def50c6d0f5caa97a080bd5 100644 (file)
@@ -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
 
index 767c3a578fb242a64aa26f2a0e31a5cddc84b888..383614f0593a152d4d23ccf0fc6da51be8164726 100644 (file)
--- 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.
 
index 7e90fbc0b0f2a5906a36bedfdec9f77918b07e61..a7a7ddd3988c51754365357b2635fa2b87bbbbae 100644 (file)
@@ -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 */
index 12f8fc64976ba739505dfd0ee97b57706804a88f..a8cc8c7eb7209efa88c9d62265cec3cad03f19b2 100644 (file)
 /* 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
 
index 92bf5f6bc5b4db1d510991e2f323aaba9a6f8b5a..d35b169a69ec702c6f6d9d02bb28172f9dcbf520 100755 (executable)
--- 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 \
index 88025bc78a3bbb80dd78f0d0858af69e9aa49eb5..35b890d8513845cad0db81f93d4eb9135ae73d0d 100644 (file)
@@ -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 \
index 87b79ae9b652ebc08d88c428bad7752b045ec933..06069626873b5092e34be840853db37097c0beeb 100644 (file)
 /* 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