1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH TCGETSID 3 2021-03-22 "GNU" "Linux Programmer's Manual"
27 tcgetsid \- get session ID
30 .BR "#define _XOPEN_SOURCE 500" " /* See feature_test_macros(7) */"
31 .B "#include <termios.h>"
33 .BI "pid_t tcgetsid(int " fd );
38 returns the session ID of the current session that has the
39 terminal associated to
41 as controlling terminal.
42 This terminal must be the controlling terminal of the calling process.
46 refers to the controlling terminal of our session,
49 will return the session ID of this session.
50 Otherwise, \-1 is returned, and
52 is set to indicate the error.
57 is not a valid file descriptor.
60 The calling process does not have a controlling terminal, or
61 it has one but it is not described by
65 is provided in glibc since version 2.1.
67 For an explanation of the terms used in this section, see
75 Interface Attribute Value
78 T} Thread safety MT-Safe
84 POSIX.1-2001, POSIX.1-2008.
86 This function is implemented via the