]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/getsid.2
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man2 / getsid.2
1 .\" Copyright (C) 1996 Andries Brouwer (aeb@cwi.nl)
2 .\" and Copyright (C) 2016 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\"
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
5 .\"
6 .\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
7 .\" Modified 2001-12-17, aeb
8 .TH getsid 2 (date) "Linux man-pages (unreleased)"
9 .SH NAME
10 getsid \- get session ID
11 .SH LIBRARY
12 Standard C library
13 .RI ( libc ", " \-lc )
14 .SH SYNOPSIS
15 .nf
16 .B #include <unistd.h>
17 .P
18 .BI "pid_t getsid(pid_t" " pid" );
19 .fi
20 .P
21 .RS -4
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
24 .RE
25 .P
26 .BR getsid ():
27 .nf
28 _XOPEN_SOURCE >= 500
29 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
30 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
31 .fi
32 .SH DESCRIPTION
33 .BR getsid ()
34 returns the session ID of the process with process ID
35 .IR pid .
36 If
37 .I pid
38 is 0,
39 .BR getsid ()
40 returns the session ID of the calling process.
41 .SH RETURN VALUE
42 On success, a session ID is returned.
43 On error, \fI(pid_t)\ \-1\fP is returned, and
44 .I errno
45 is set to indicate the error.
46 .SH ERRORS
47 .TP
48 .B EPERM
49 A process with process ID
50 .I pid
51 exists, but it is not in the same session as the calling process,
52 and the implementation considers this an error.
53 .TP
54 .B ESRCH
55 No process with process ID
56 .I pid
57 was found.
58 .SH VERSIONS
59 Linux does not return
60 .BR EPERM .
61 .SH STANDARDS
62 POSIX.1-2008.
63 .SH HISTORY
64 POSIX.1-2001, SVr4.
65 Linux 2.0.
66 .\" Linux has this system call since Linux 1.3.44.
67 .\" There is libc support since libc 5.2.19.
68 .SH NOTES
69 See
70 .BR credentials (7)
71 for a description of sessions and session IDs.
72 .SH SEE ALSO
73 .BR getpgid (2),
74 .BR setsid (2),
75 .BR credentials (7)