1GETSID(2)                  Linux Programmer's Manual                 GETSID(2)
2
3
4

NAME

6       getsid - get session ID
7

SYNOPSIS

9       #include <unistd.h>
10
11       pid_t getsid(pid_t pid);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       getsid():
16           _XOPEN_SOURCE >= 500
17               || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
18

DESCRIPTION

20       getsid(0)  returns the session ID of the calling process.  getsid() re‐
21       turns the session ID of the process with process ID pid.  If pid is  0,
22       getsid() returns the session ID of the calling process.
23

RETURN VALUE

25       On  success,  a  session  ID  is returned.  On error, (pid_t) -1 is re‐
26       turned, and errno is set to indicate the error.
27

ERRORS

29       EPERM  A process with process ID pid exists, but it is not in the  same
30              session as the calling process, and the implementation considers
31              this an error.
32
33       ESRCH  No process with process ID pid was found.
34

VERSIONS

36       This system call is available on Linux since version 2.0.
37

CONFORMING TO

39       POSIX.1-2001, POSIX.1-2008, SVr4.
40

NOTES

42       Linux does not return EPERM.
43
44       See credentials(7) for a description of sessions and session IDs.
45

SEE ALSO

47       getpgid(2), setsid(2), credentials(7)
48

COLOPHON

50       This page is part of release 5.13 of the Linux  man-pages  project.   A
51       description  of  the project, information about reporting bugs, and the
52       latest    version    of    this    page,    can     be     found     at
53       https://www.kernel.org/doc/man-pages/.
54
55
56
57Linux                             2021-03-22                         GETSID(2)
Impressum