1TCGETSID(3) Linux Programmer's Manual TCGETSID(3)
2
3
4
6 tcgetsid - get session ID
7
9 #define _XOPEN_SOURCE 500 /* See feature_test_macros(7) */
10 #include <termios.h>
11
12 pid_t tcgetsid(int fd);
13
15 The function tcgetsid() returns the session ID of the current session
16 that has the terminal associated to fd as controlling terminal. This
17 terminal must be the controlling terminal of the calling process.
18
20 When fd refers to the controlling terminal of our session, the function
21 tcgetsid() will return the session ID of this session. Otherwise, -1
22 is returned, and errno is set to indicate the error.
23
25 EBADF fd is not a valid file descriptor.
26
27 ENOTTY The calling process does not have a controlling terminal, or it
28 has one but it is not described by fd.
29
31 tcgetsid() is provided in glibc since version 2.1.
32
34 For an explanation of the terms used in this section, see at‐
35 tributes(7).
36
37 ┌────────────────────────────────────────────┬───────────────┬─────────┐
38 │Interface │ Attribute │ Value │
39 ├────────────────────────────────────────────┼───────────────┼─────────┤
40 │tcgetsid() │ Thread safety │ MT-Safe │
41 └────────────────────────────────────────────┴───────────────┴─────────┘
42
44 POSIX.1-2001, POSIX.1-2008.
45
47 This function is implemented via the TIOCGSID ioctl(2), present since
48 Linux 2.1.71.
49
51 getsid(2)
52
54 This page is part of release 5.13 of the Linux man-pages project. A
55 description of the project, information about reporting bugs, and the
56 latest version of this page, can be found at
57 https://www.kernel.org/doc/man-pages/.
58
59
60
61GNU 2021-03-22 TCGETSID(3)