From 49ee14dac5da2249f0f55f00190a9b9f01d23642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Mon, 10 Nov 2003 06:35:36 +0000 Subject: Patch #839038: Add getsid(2). --- Doc/lib/libos.tex | 6 ++++++ Modules/posixmodule.c | 22 ++++++++++++++++++++++ configure | 5 +++-- configure.in | 2 +- pyconfig.h.in | 12 ++++++++---- 5 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex index b93ce77..624fbf8 100644 --- a/Doc/lib/libos.tex +++ b/Doc/lib/libos.tex @@ -254,6 +254,12 @@ Set the current process's real and effective group ids. Availability: \UNIX. \end{funcdesc} +\begin{funcdesc}{getsid}{pid} +Calls the system call \cfunction{getsid()}. See the \UNIX{} manual +for the semantics. +Availability: \UNIX. +\end{funcdesc} + \begin{funcdesc}{setsid}{} Calls the system call \cfunction{setsid()}. See the \UNIX{} manual for the semantics. 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 */ diff --git a/configure b/configure index 1475a04..a5549cc 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.438 . +# From configure.in Revision: 1.439 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.57 for python 2.4. # @@ -13096,10 +13096,11 @@ echo "${ECHO_T}MACHDEP_OBJS" >&6 + for ac_func in alarm chown clock confstr ctermid execv \ fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ - getpriority getpwent getwd \ + getpriority getpwent getsid getwd \ kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ diff --git a/configure.in b/configure.in index 289b2cf..c567d21 100644 --- a/configure.in +++ b/configure.in @@ -2074,7 +2074,7 @@ AC_MSG_RESULT(MACHDEP_OBJS) AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \ fork fpathconf ftime ftruncate \ gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \ - getpriority getpwent getwd \ + getpriority getpwent getsid getwd \ kill killpg lchown lstat mkfifo mknod mktime \ mremap nice pathconf pause plock poll pthread_init \ putenv readlink realpath \ diff --git a/pyconfig.h.in b/pyconfig.h.in index 2ab8b9c..b999f33 100644 --- a/pyconfig.h.in +++ b/pyconfig.h.in @@ -126,6 +126,9 @@ /* Define to 1 if you have the `fstatvfs' function. */ #undef HAVE_FSTATVFS +/* Define if you have the 'fsync' function. */ +#undef HAVE_FSYNC + /* Define to 1 if you have the `ftell64' function. */ #undef HAVE_FTELL64 @@ -198,6 +201,9 @@ /* Define to 1 if you have the `getpwent' function. */ #undef HAVE_GETPWENT +/* Define to 1 if you have the `getsid' function. */ +#undef HAVE_GETSID + /* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY @@ -485,9 +491,6 @@ /* Define if you have the 'symlink' function. */ #undef HAVE_SYMLINK -/* Define if you have the 'fsync' function. */ -#undef HAVE_FSYNC - /* Define to 1 if you have the `sysconf' function. */ #undef HAVE_SYSCONF @@ -616,7 +619,8 @@ #undef HAVE_UNSETENV /* Define if you have a useable wchar_t type defined in wchar.h; useable means - wchar_t must be 16-bit unsigned type. (see Include/unicodeobject.h). */ + wchar_t must be an unsigned type with at least 16 bits. (see + Include/unicodeobject.h). */ #undef HAVE_USABLE_WCHAR_T /* Define to 1 if you have the `utimes' function. */ -- cgit v0.12