Patch #839038: Add getsid(2).

This commit is contained in:
Martin v. Löwis 2003-11-10 06:35:36 +00:00
parent 967b063add
commit 49ee14dac5
5 changed files with 40 additions and 7 deletions

View File

@ -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.

View File

@ -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 */

5
configure vendored
View File

@ -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.
#
@ -13094,12 +13094,13 @@ 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 \

View File

@ -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 \

View File

@ -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. */