1GETSID(2) Linux Programmer's Manual GETSID(2)
2
3
4
6 getsid - get session ID
7
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 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
17 || /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
18
20 getsid(0) returns the session ID of the calling process. getsid(p)
21 returns the session ID of the process with process ID p. (The session
22 ID of a process is the process group ID of the session leader.)
23
25 On success, a session ID is returned. On error, (pid_t) -1 will be
26 returned, and errno is set appropriately.
27
29 EPERM A process with process ID p 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 p was found.
34
36 This system call is available on Linux since version 2.0.
37
39 SVr4, POSIX.1-2001.
40
42 Linux does not return EPERM.
43
45 getpgid(2), setsid(2), credentials(7)
46
48 This page is part of release 3.53 of the Linux man-pages project. A
49 description of the project, and information about reporting bugs, can
50 be found at http://www.kernel.org/doc/man-pages/.
51
52
53
54Linux 2010-09-26 GETSID(2)