1 .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
2 .\" and Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
26 .\" Modified 2001-12-17, aeb
27 .TH GETSID 2 2016-10-08 "Linux" "Linux Programmer's Manual"
29 getsid \- get session ID
31 .B #include <unistd.h>
33 .BI "pid_t getsid(pid_t" " pid" );
36 Feature Test Macro Requirements for glibc (see
37 .BR feature_test_macros (7)):
44 _XOPEN_SOURCE\ >=\ 500
45 .\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
47 || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
53 returns the session ID of the calling process.
55 returns the session ID of the process with process ID
61 returns the session ID of the calling process.
63 On success, a session ID is returned.
64 On error, \fI(pid_t)\ \-1\fP will be returned, and
70 A process with process ID
72 exists, but it is not in the same session as the calling process,
73 and the implementation considers this an error.
76 No process with process ID
80 This system call is available on Linux since version 2.0.
81 .\" Linux has this system call since Linux 1.3.44.
82 .\" There is libc support since libc 5.2.19.
84 POSIX.1-2001, POSIX.1-2008, SVr4.
91 for a description of sessions and session IDs.