]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/getsid.2
proc.5: ffix
[thirdparty/man-pages.git] / man2 / getsid.2
CommitLineData
fea681da 1.\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
3d8af603 2.\" and Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da 3.\"
1dd72f9c 4.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
fea681da
MK
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.
9.\"
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.
14.\"
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.
19.\"
20.\" You should have received a copy of the GNU General Public
c715f741
MK
21.\" License along with this manual; if not, see
22.\" <http://www.gnu.org/licenses/>.
6a8d8745 23.\" %%%LICENSE_END
fea681da
MK
24.\"
25.\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
26.\" Modified 2001-12-17, aeb
4b8c67d9 27.TH GETSID 2 2017-09-15 "Linux" "Linux Programmer's Manual"
fea681da
MK
28.SH NAME
29getsid \- get session ID
30.SH SYNOPSIS
cc94f6aa
AF
31.B #include <sys/types.h>
32.br
fea681da 33.B #include <unistd.h>
68e4db0a 34.PP
fea681da 35.BI "pid_t getsid(pid_t" " pid" );
68e4db0a 36.PP
cc4615cc
MK
37.in -4n
38Feature Test Macro Requirements for glibc (see
39.BR feature_test_macros (7)):
40.in
68e4db0a 41.PP
7f970341
MK
42.ad l
43.PD 0
cc4615cc 44.BR getsid ():
7f970341 45.RS 4
cf7fa0a1
MK
46_XOPEN_SOURCE\ >=\ 500
47.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
3ba63d80 48.br
cf7fa0a1 49 || /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
7f970341
MK
50.RE
51.PD
52.ad
fea681da 53.SH DESCRIPTION
197889d0 54.I getsid(0)
fea681da 55returns the session ID of the calling process.
3d8af603 56.BR getsid ()
fea681da 57returns the session ID of the process with process ID
3d8af603
MK
58.IR pid .
59If
60.I pid
61is 0,
62.BR getsid ()
63returns the session ID of the calling process.
d676e60b 64.SH RETURN VALUE
2d41b332 65On success, a session ID is returned.
009df872 66On error, \fI(pid_t)\ \-1\fP will be returned, and
fea681da
MK
67.I errno
68is set appropriately.
69.SH ERRORS
70.TP
71.B EPERM
72A process with process ID
a12db812 73.I pid
a1ffe9f5 74exists, but it is not in the same session as the calling process,
fea681da
MK
75and the implementation considers this an error.
76.TP
77.B ESRCH
78No process with process ID
a12db812 79.I pid
fea681da 80was found.
12bbec1b
MK
81.SH VERSIONS
82This system call is available on Linux since version 2.0.
83.\" Linux has this system call since Linux 1.3.44.
84.\" There is libc support since libc 5.2.19.
47297adb 85.SH CONFORMING TO
cc37dd4d 86POSIX.1-2001, POSIX.1-2008, SVr4.
fea681da 87.SH NOTES
682edefb
MK
88Linux does not return
89.BR EPERM .
efeece04 90.PP
3d8af603
MK
91See
92.BR credentials (7)
93for a description of sessions and session IDs.
47297adb 94.SH SEE ALSO
fea681da 95.BR getpgid (2),
50e5322c 96.BR setsid (2),
cc4615cc 97.BR credentials (7)