summaryrefslogtreecommitdiffstats
path: root/Modules/posixmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-11-10 06:35:36 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-11-10 06:35:36 (GMT)
commit49ee14dac5da2249f0f55f00190a9b9f01d23642 (patch)
treedde1b85066268f6d5ca6e28b3606a00854ad2d72 /Modules/posixmodule.c
parent967b063add196bc2da55fdb81f91a802600b7b7b (diff)
downloadcpython-49ee14dac5da2249f0f55f00190a9b9f01d23642.zip
cpython-49ee14dac5da2249f0f55f00190a9b9f01d23642.tar.gz
cpython-49ee14dac5da2249f0f55f00190a9b9f01d23642.tar.bz2
Patch #839038: Add getsid(2).
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r--Modules/posixmodule.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 9c58c9d..4b3d825 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -4755,6 +4755,25 @@ Return a tuple of floating point numbers indicating process times.");
#endif
+#ifdef HAVE_GETSID
+PyDoc_STRVAR(posix_getsid__doc__,
+"getsid(pid) -> sid\n\n\
+Call the system call getsid().");
+
+static PyObject *
+posix_getsid(PyObject *self, PyObject *args)
+{
+ int pid, sid;
+ if (!PyArg_ParseTuple(args, "i:getsid", &pid))
+ return NULL;
+ sid = getsid(pid);
+ if (sid < 0)
+ return posix_error();
+ return PyInt_FromLong((long)sid);
+}
+#endif /* HAVE_GETSID */
+
+
#ifdef HAVE_SETSID
PyDoc_STRVAR(posix_setsid__doc__,
"setsid()\n\n\
@@ -7020,6 +7039,9 @@ static PyMethodDef posix_methods[] = {
#if defined(HAVE_WAITPID) || defined(HAVE_CWAIT)
{"waitpid", posix_waitpid, METH_VARARGS, posix_waitpid__doc__},
#endif /* HAVE_WAITPID */
+#ifdef HAVE_GETSID
+ {"getsid", posix_getsid, METH_VARARGS, posix_getsid__doc__},
+#endif /* HAVE_GETSID */
#ifdef HAVE_SETSID
{"setsid", posix_setsid, METH_NOARGS, posix_setsid__doc__},
#endif /* HAVE_SETSID */