1getsid(2) System Calls Manual getsid(2)
2
3
4
6 getsid - get session ID
7
9 Standard C library (libc, -lc)
10
12 #include <unistd.h>
13
14 pid_t getsid(pid_t pid);
15
16 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
17
18 getsid():
19 _XOPEN_SOURCE >= 500
20 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
21
23 getsid() returns the session ID of the process with process ID pid. If
24 pid is 0, getsid() returns the session ID of the calling process.
25
27 On success, a session ID is returned. On error, (pid_t) -1 is re‐
28 turned, and errno is set to indicate the error.
29
31 EPERM A process with process ID pid exists, but it is not in the same
32 session as the calling process, and the implementation considers
33 this an error.
34
35 ESRCH No process with process ID pid was found.
36
38 Linux does not return EPERM.
39
41 POSIX.1-2008.
42
44 POSIX.1-2001, SVr4. Linux 2.0.
45
47 See credentials(7) for a description of sessions and session IDs.
48
50 getpgid(2), setsid(2), credentials(7)
51
52
53
54Linux man-pages 6.05 2023-03-30 getsid(2)