161 lines
3.3 KiB
HTML
161 lines
3.3 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of GETSID</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>GETSID</H1>
|
|
Section: Linux Programmer's Manual (2)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
getsid - get session ID
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/sys/types.h">sys/types.h</A>></B>
|
|
|
|
<BR>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/unistd.h">unistd.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>pid_t getsid(pid_t</B><I> pid</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
|
|
|
|
<B>getsid</B>():
|
|
|
|
<DL COMPACT><DT id="1"><DD>
|
|
_XOPEN_SOURCE >= 500
|
|
|
|
<BR>
|
|
|
|
<BR> || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
|
|
</DL>
|
|
|
|
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
<I>getsid(0)</I>
|
|
|
|
returns the session ID of the calling process.
|
|
<B>getsid</B>()
|
|
|
|
returns the session ID of the process with process ID
|
|
<I>pid</I>.
|
|
|
|
If
|
|
<I>pid</I>
|
|
|
|
is 0,
|
|
<B>getsid</B>()
|
|
|
|
returns the session ID of the calling process.
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success, a session ID is returned.
|
|
On error, <I>(pid_t) -1</I> will be returned, and
|
|
<I>errno</I>
|
|
|
|
is set appropriately.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
<DL COMPACT>
|
|
<DT id="2"><B>EPERM</B>
|
|
|
|
<DD>
|
|
A process with process ID
|
|
<I>pid</I>
|
|
|
|
exists, but it is not in the same session as the calling process,
|
|
and the implementation considers this an error.
|
|
<DT id="3"><B>ESRCH</B>
|
|
|
|
<DD>
|
|
No process with process ID
|
|
<I>pid</I>
|
|
|
|
was found.
|
|
</DL>
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
This system call is available on Linux since version 2.0.
|
|
|
|
|
|
<A NAME="lbAH"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008, SVr4.
|
|
<A NAME="lbAI"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
Linux does not return
|
|
<B>EPERM</B>.
|
|
|
|
<P>
|
|
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?7+credentials">credentials</A></B>(7)
|
|
|
|
for a description of sessions and session IDs.
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+getpgid">getpgid</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+setsid">setsid</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+credentials">credentials</A></B>(7)
|
|
|
|
<A NAME="lbAK"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="4"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="5"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="6"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="7"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="8"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="9"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="10"><A HREF="#lbAH">CONFORMING TO</A><DD>
|
|
<DT id="11"><A HREF="#lbAI">NOTES</A><DD>
|
|
<DT id="12"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="13"><A HREF="#lbAK">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:32 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|