]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/getsid.2
chdir.2, chmod.2, chown.2, gethostname.2, getsid.2, pread.2, setpgid.2, sigaltstack...
[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
19.\" License along with this manual; if not, write to the Free
20.\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21.\" USA.
22.\"
23.\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
24.\" Modified 2001-12-17, aeb
50831f9b 25.TH GETSID 2 2010-09-20 "Linux" "Linux Programmer's Manual"
fea681da
MK
26.SH NAME
27getsid \- get session ID
28.SH SYNOPSIS
29.B #include <unistd.h>
30.sp
31.BI "pid_t getsid(pid_t" " pid" );
cc4615cc
MK
32.sp
33.in -4n
34Feature Test Macro Requirements for glibc (see
35.BR feature_test_macros (7)):
36.in
37.sp
7f970341
MK
38.ad l
39.PD 0
cc4615cc 40.BR getsid ():
7f970341 41.RS 4
7f970341
MK
42_XOPEN_SOURCE\ >=\ 500 ||
43_XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
3ba63d80
MK
44.br
45|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
7f970341
MK
46.RE
47.PD
48.ad
fea681da 49.SH DESCRIPTION
197889d0 50.I getsid(0)
fea681da 51returns the session ID of the calling process.
197889d0 52.I getsid(p)
fea681da
MK
53returns the session ID of the process with process ID
54.IR p .
55(The session ID of a process is the process group ID of the
56session leader.)
d676e60b 57.SH RETURN VALUE
2d41b332 58On success, a session ID is returned.
009df872 59On error, \fI(pid_t)\ \-1\fP will be returned, and
fea681da
MK
60.I errno
61is set appropriately.
62.SH ERRORS
63.TP
64.B EPERM
65A process with process ID
66.I p
a1ffe9f5 67exists, but it is not in the same session as the calling process,
fea681da
MK
68and the implementation considers this an error.
69.TP
70.B ESRCH
71No process with process ID
72.I p
73was found.
12bbec1b
MK
74.SH VERSIONS
75This system call is available on Linux since version 2.0.
76.\" Linux has this system call since Linux 1.3.44.
77.\" There is libc support since libc 5.2.19.
fea681da 78.SH "CONFORMING TO"
97c1eac8 79SVr4, POSIX.1-2001.
fea681da 80.SH NOTES
682edefb
MK
81Linux does not return
82.BR EPERM .
fea681da
MK
83.SH "SEE ALSO"
84.BR getpgid (2),
50e5322c 85.BR setsid (2),
cc4615cc 86.BR credentials (7)