mount_setattr.2: ffix
[man-pages.git] / man3 / tcgetsid.3
blobdce748ffc809cdbbb40c355ac8b563da5348c09a
1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2 .\"
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.
7 .\"
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.
12 .\"
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
19 .\" professionally.
20 .\"
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
23 .\" %%%LICENSE_END
24 .\"
25 .TH TCGETSID 3 2021-03-22 "GNU" "Linux Programmer's Manual"
26 .SH NAME
27 tcgetsid \- get session ID
28 .SH SYNOPSIS
29 .nf
30 .BR "#define _XOPEN_SOURCE 500" "        /* See feature_test_macros(7) */"
31 .B "#include <termios.h>"
32 .PP
33 .BI "pid_t tcgetsid(int " fd );
34 .fi
35 .SH DESCRIPTION
36 The function
37 .BR tcgetsid ()
38 returns the session ID of the current session that has the
39 terminal associated to
40 .I fd
41 as controlling terminal.
42 This terminal must be the controlling terminal of the calling process.
43 .SH RETURN VALUE
44 When
45 .I fd
46 refers to the controlling terminal of our session,
47 the function
48 .BR tcgetsid ()
49 will return the session ID of this session.
50 Otherwise, \-1 is returned, and
51 .I errno
52 is set to indicate the error.
53 .SH ERRORS
54 .TP
55 .B EBADF
56 .I fd
57 is not a valid file descriptor.
58 .TP
59 .B ENOTTY
60 The calling process does not have a controlling terminal, or
61 it has one but it is not described by
62 .IR fd .
63 .SH VERSIONS
64 .BR tcgetsid ()
65 is provided in glibc since version 2.1.
66 .SH ATTRIBUTES
67 For an explanation of the terms used in this section, see
68 .BR attributes (7).
69 .ad l
70 .nh
71 .TS
72 allbox;
73 lbx lb lb
74 l l l.
75 Interface       Attribute       Value
77 .BR tcgetsid ()
78 T}      Thread safety   MT-Safe
79 .TE
80 .hy
81 .ad
82 .sp 1
83 .SH CONFORMING TO
84 POSIX.1-2001, POSIX.1-2008.
85 .SH NOTES
86 This function is implemented via the
87 .B TIOCGSID
88 .BR ioctl (2),
89 present
90 since Linux 2.1.71.
91 .SH SEE ALSO
92 .BR getsid (2)