1tcgetsid(3) Library Functions Manual tcgetsid(3)
2
3
4
6 tcgetsid - get session ID
7
9 Standard C library (libc, -lc)
10
12 #define _XOPEN_SOURCE 500 /* See feature_test_macros(7) */
13 #include <termios.h>
14
15 pid_t tcgetsid(int fd);
16
18 The function tcgetsid() returns the session ID of the current session
19 that has the terminal associated to fd as controlling terminal. This
20 terminal must be the controlling terminal of the calling process.
21
23 When fd refers to the controlling terminal of our session, the function
24 tcgetsid() will return the session ID of this session. Otherwise, -1
25 is returned, and errno is set to indicate the error.
26
28 EBADF fd is not a valid file descriptor.
29
30 ENOTTY The calling process does not have a controlling terminal, or it
31 has one but it is not described by fd.
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-2008.
45
47 glibc 2.1. POSIX.1-2001.
48
49 This function is implemented via the TIOCGSID ioctl(2), present since
50 Linux 2.1.71.
51
53 getsid(2)
54
55
56
57Linux man-pages 6.04 2023-03-30 tcgetsid(3)