]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/getsid.2
getent.1, _syscall.2, acct.2, adjtimex.2, bdflush.2, brk.2, cacheflush.2, getsid...
[thirdparty/man-pages.git] / man2 / getsid.2
CommitLineData
fea681da
MK
1.\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
2.\"
3.\" This is free documentation; you can redistribute it and/or
4.\" modify it under the terms of the GNU General Public License as
5.\" published by the Free Software Foundation; either version 2 of
6.\" the License, or (at your option) any later version.
7.\"
8.\" The GNU General Public License's references to "object code"
9.\" and "executables" are to be interpreted as the output of any
10.\" document formatting or typesetting system, including
11.\" intermediate and printed output.
12.\"
13.\" This manual is distributed in the hope that it will be useful,
14.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.\" GNU General Public License for more details.
17.\"
18.\" You should have received a copy of the GNU General Public
c715f741
MK
19.\" License along with this manual; if not, see
20.\" <http://www.gnu.org/licenses/>.
fea681da
MK
21.\"
22.\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
23.\" Modified 2001-12-17, aeb
7990e026 24.TH GETSID 2 2010-09-26 "Linux" "Linux Programmer's Manual"
fea681da
MK
25.SH NAME
26getsid \- get session ID
27.SH SYNOPSIS
28.B #include <unistd.h>
29.sp
30.BI "pid_t getsid(pid_t" " pid" );
cc4615cc
MK
31.sp
32.in -4n
33Feature Test Macro Requirements for glibc (see
34.BR feature_test_macros (7)):
35.in
36.sp
7f970341
MK
37.ad l
38.PD 0
cc4615cc 39.BR getsid ():
7f970341 40.RS 4
7f970341
MK
41_XOPEN_SOURCE\ >=\ 500 ||
42_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
3ba63d80
MK
43.br
44|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
7f970341
MK
45.RE
46.PD
47.ad
fea681da 48.SH DESCRIPTION
197889d0 49.I getsid(0)
fea681da 50returns the session ID of the calling process.
197889d0 51.I getsid(p)
fea681da
MK
52returns the session ID of the process with process ID
53.IR p .
54(The session ID of a process is the process group ID of the
55session leader.)
d676e60b 56.SH RETURN VALUE
2d41b332 57On success, a session ID is returned.
009df872 58On error, \fI(pid_t)\ \-1\fP will be returned, and
fea681da
MK
59.I errno
60is set appropriately.
61.SH ERRORS
62.TP
63.B EPERM
64A process with process ID
65.I p
a1ffe9f5 66exists, but it is not in the same session as the calling process,
fea681da
MK
67and the implementation considers this an error.
68.TP
69.B ESRCH
70No process with process ID
71.I p
72was found.
12bbec1b
MK
73.SH VERSIONS
74This system call is available on Linux since version 2.0.
75.\" Linux has this system call since Linux 1.3.44.
76.\" There is libc support since libc 5.2.19.
47297adb 77.SH CONFORMING TO
97c1eac8 78SVr4, POSIX.1-2001.
fea681da 79.SH NOTES
682edefb
MK
80Linux does not return
81.BR EPERM .
47297adb 82.SH SEE ALSO
fea681da 83.BR getpgid (2),
50e5322c 84.BR setsid (2),
cc4615cc 85.BR credentials (7)