Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 49ee14d

Browse files
committed
Patch #839038: Add getsid(2).
1 parent 967b063 commit 49ee14d

5 files changed

Lines changed: 40 additions & 7 deletions

File tree

Doc/lib/libos.tex

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,12 @@ \subsection{Process Parameters \label{os-procinfo}}
254254
Availability: \UNIX.
255255
\end{funcdesc}
256256

257+
\begin{funcdesc}{getsid}{pid}
258+
Calls the system call \cfunction{getsid()}. See the \UNIX{} manual
259+
for the semantics.
260+
Availability: \UNIX.
261+
\end{funcdesc}
262+
257263
\begin{funcdesc}{setsid}{}
258264
Calls the system call \cfunction{setsid()}. See the \UNIX{} manual
259265
for the semantics.

Modules/posixmodule.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4755,6 +4755,25 @@ Return a tuple of floating point numbers indicating process times.");
47554755
#endif
47564756

47574757

4758+
#ifdef HAVE_GETSID
4759+
PyDoc_STRVAR(posix_getsid__doc__,
4760+
"getsid(pid) -> sid\n\n\
4761+
Call the system call getsid().");
4762+
4763+
static PyObject *
4764+
posix_getsid(PyObject *self, PyObject *args)
4765+
{
4766+
int pid, sid;
4767+
if (!PyArg_ParseTuple(args, "i:getsid", &pid))
4768+
return NULL;
4769+
sid = getsid(pid);
4770+
if (sid < 0)
4771+
return posix_error();
4772+
return PyInt_FromLong((long)sid);
4773+
}
4774+
#endif /* HAVE_GETSID */
4775+
4776+
47584777
#ifdef HAVE_SETSID
47594778
PyDoc_STRVAR(posix_setsid__doc__,
47604779
"setsid()\n\n\
@@ -7020,6 +7039,9 @@ static PyMethodDef posix_methods[] = {
70207039
#if defined(HAVE_WAITPID) || defined(HAVE_CWAIT)
70217040
{"waitpid", posix_waitpid, METH_VARARGS, posix_waitpid__doc__},
70227041
#endif /* HAVE_WAITPID */
7042+
#ifdef HAVE_GETSID
7043+
{"getsid", posix_getsid, METH_VARARGS, posix_getsid__doc__},
7044+
#endif /* HAVE_GETSID */
70237045
#ifdef HAVE_SETSID
70247046
{"setsid", posix_setsid, METH_NOARGS, posix_setsid__doc__},
70257047
#endif /* HAVE_SETSID */

configure

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 1.438 .
2+
# From configure.in Revision: 1.439 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.57 for python 2.4.
55
#
@@ -13094,12 +13094,13 @@ echo "${ECHO_T}MACHDEP_OBJS" >&6
1309413094

1309513095

1309613096

13097+
1309713098

1309813099

1309913100
for ac_func in alarm chown clock confstr ctermid execv \
1310013101
fork fpathconf ftime ftruncate \
1310113102
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
13102-
getpriority getpwent getwd \
13103+
getpriority getpwent getsid getwd \
1310313104
kill killpg lchown lstat mkfifo mknod mktime \
1310413105
mremap nice pathconf pause plock poll pthread_init \
1310513106
putenv readlink realpath \

configure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2074,7 +2074,7 @@ AC_MSG_RESULT(MACHDEP_OBJS)
20742074
AC_CHECK_FUNCS(alarm chown clock confstr ctermid execv \
20752075
fork fpathconf ftime ftruncate \
20762076
gai_strerror getgroups getlogin getloadavg getpeername getpgid getpid \
2077-
getpriority getpwent getwd \
2077+
getpriority getpwent getsid getwd \
20782078
kill killpg lchown lstat mkfifo mknod mktime \
20792079
mremap nice pathconf pause plock poll pthread_init \
20802080
putenv readlink realpath \

pyconfig.h.in

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@
126126
/* Define to 1 if you have the `fstatvfs' function. */
127127
#undef HAVE_FSTATVFS
128128

129+
/* Define if you have the 'fsync' function. */
130+
#undef HAVE_FSYNC
131+
129132
/* Define to 1 if you have the `ftell64' function. */
130133
#undef HAVE_FTELL64
131134

@@ -198,6 +201,9 @@
198201
/* Define to 1 if you have the `getpwent' function. */
199202
#undef HAVE_GETPWENT
200203

204+
/* Define to 1 if you have the `getsid' function. */
205+
#undef HAVE_GETSID
206+
201207
/* Define to 1 if you have the `gettimeofday' function. */
202208
#undef HAVE_GETTIMEOFDAY
203209

@@ -485,9 +491,6 @@
485491
/* Define if you have the 'symlink' function. */
486492
#undef HAVE_SYMLINK
487493

488-
/* Define if you have the 'fsync' function. */
489-
#undef HAVE_FSYNC
490-
491494
/* Define to 1 if you have the `sysconf' function. */
492495
#undef HAVE_SYSCONF
493496

@@ -616,7 +619,8 @@
616619
#undef HAVE_UNSETENV
617620

618621
/* Define if you have a useable wchar_t type defined in wchar.h; useable means
619-
wchar_t must be 16-bit unsigned type. (see Include/unicodeobject.h). */
622+
wchar_t must be an unsigned type with at least 16 bits. (see
623+
Include/unicodeobject.h). */
620624
#undef HAVE_USABLE_WCHAR_T
621625

622626
/* Define to 1 if you have the `utimes' function. */

0 commit comments

Comments
 (0)