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