summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-06-13 21:09:11 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2002-06-13 21:09:11 (GMT)
commit606edc1d971a0c5e4f5d379ecfa69f42b5b1d691 (patch)
treea2145d170070b80f06ff05e2285f02a5e8fe9056 /Modules
parent14f8b4cfcb98de74b9c6e9316539be9e2a5cd31f (diff)
downloadcpython-606edc1d971a0c5e4f5d379ecfa69f42b5b1d691.zip
cpython-606edc1d971a0c5e4f5d379ecfa69f42b5b1d691.tar.gz
cpython-606edc1d971a0c5e4f5d379ecfa69f42b5b1d691.tar.bz2
Patch #568235: Add posix.setpgid.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c22
1 files changed, 22 insertions, 0 deletions
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 */