1GETSID(2) Linux Programmer's Manual GETSID(2)
2
3
4
6 getsid - get session ID
7
9 #include <sys/types.h>
10 #include <unistd.h>
11
12 pid_t getsid(pid_t pid);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 getsid():
17 _XOPEN_SOURCE >= 500
18 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
19
21 getsid(0) returns the session ID of the calling process. getsid()
22 returns the session ID of the process with process ID pid. If pid is
23 0, getsid() returns the session ID of the calling process.
24
26 On success, a session ID is returned. On error, (pid_t) -1 will be
27 returned, and errno is set appropriately.
28
30 EPERM A process with process ID pid exists, but it is not in the same
31 session as the calling process, and the implementation considers
32 this an error.
33
34 ESRCH No process with process ID pid was found.
35
37 This system call is available on Linux since version 2.0.
38
40 POSIX.1-2001, POSIX.1-2008, SVr4.
41
43 Linux does not return EPERM.
44
45 See credentials(7) for a description of sessions and session IDs.
46
48 getpgid(2), setsid(2), credentials(7)
49
51 This page is part of release 4.15 of the Linux man-pages project. A
52 description of the project, information about reporting bugs, and the
53 latest version of this page, can be found at
54 https://www.kernel.org/doc/man-pages/.
55
56
57
58Linux 2017-09-15 GETSID(2)