1getsid(2)                     System Calls Manual                    getsid(2)
2
3
4

NAME

6       getsid - get session ID
7

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

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

VERSIONS

38       Linux does not return EPERM.
39

STANDARDS

41       POSIX.1-2008.
42

HISTORY

44       POSIX.1-2001, SVr4.  Linux 2.0.
45

NOTES

47       See credentials(7) for a description of sessions and session IDs.
48

SEE ALSO

50       getpgid(2), setsid(2), credentials(7)
51
52
53
54Linux man-pages 6.04              2023-03-30                         getsid(2)
Impressum