]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/getsid.2
spfix
[thirdparty/man-pages.git] / man2 / getsid.2
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
25 .TH GETSID 2 2001-12-17 "Linux" "Linux Programmer's Manual"
26 .SH NAME
27 getsid \- get session ID
28 .SH SYNOPSIS
29 .B #include <unistd.h>
30 .sp
31 .BI "pid_t getsid(pid_t" " pid" );
32 .SH DESCRIPTION
33 .I getsid(0)
34 returns the session ID of the calling process.
35 .I getsid(p)
36 returns the session ID of the process with process ID
37 .IR p .
38 (The session ID of a process is the process group ID of the
39 session leader.)
40 .SH RETURN VALUE
41 On success, a session ID is returned.
42 On error, (pid_t) \-1 will be returned, and
43 .I errno
44 is set appropriately.
45 .SH ERRORS
46 .TP
47 .B EPERM
48 A process with process ID
49 .I p
50 exists, but it is not in the same session as the current process,
51 and the implementation considers this an error.
52 .TP
53 .B ESRCH
54 No process with process ID
55 .I p
56 was found.
57 .SH "CONFORMING TO"
58 SVr4, POSIX.1-2001.
59 .SH NOTES
60 Linux does not return EPERM.
61 .LP
62 Linux has this system call since Linux 1.3.44.
63 There is libc support since libc 5.2.19.
64 .LP
65 To get the prototype under glibc, define both _XOPEN_SOURCE and
66 _XOPEN_SOURCE_EXTENDED, or use "#define _XOPEN_SOURCE \fIn\fP"
67 for some integer \fIn\fP larger than or equal to 500.
68 .SH "SEE ALSO"
69 .BR getpgid (2),
70 .BR setsid (2),
71 .BR credentials (7),
72 .BR feature_test_macros (7)