]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/tcgetsid.3
man*/: srcfix (Use .P instead of .PP or .LP)
[thirdparty/man-pages.git] / man3 / tcgetsid.3
1 '\" t
2 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .TH tcgetsid 3 (date) "Linux man-pages (unreleased)"
7 .SH NAME
8 tcgetsid \- get session ID
9 .SH LIBRARY
10 Standard C library
11 .RI ( libc ", " \-lc )
12 .SH SYNOPSIS
13 .nf
14 .BR "#define _XOPEN_SOURCE 500" " /* See feature_test_macros(7) */"
15 .B "#include <termios.h>"
16 .P
17 .BI "pid_t tcgetsid(int " fd );
18 .fi
19 .SH DESCRIPTION
20 The function
21 .BR tcgetsid ()
22 returns the session ID of the current session that has the
23 terminal associated to
24 .I fd
25 as controlling terminal.
26 This terminal must be the controlling terminal of the calling process.
27 .SH RETURN VALUE
28 When
29 .I fd
30 refers to the controlling terminal of our session,
31 the function
32 .BR tcgetsid ()
33 will return the session ID of this session.
34 Otherwise, \-1 is returned, and
35 .I errno
36 is set to indicate the error.
37 .SH ERRORS
38 .TP
39 .B EBADF
40 .I fd
41 is not a valid file descriptor.
42 .TP
43 .B ENOTTY
44 The calling process does not have a controlling terminal, or
45 it has one but it is not described by
46 .IR fd .
47 .SH ATTRIBUTES
48 For an explanation of the terms used in this section, see
49 .BR attributes (7).
50 .TS
51 allbox;
52 lbx lb lb
53 l l l.
54 Interface Attribute Value
55 T{
56 .na
57 .nh
58 .BR tcgetsid ()
59 T} Thread safety MT-Safe
60 .TE
61 .SH STANDARDS
62 POSIX.1-2008.
63 .SH HISTORY
64 glibc 2.1.
65 POSIX.1-2001.
66 .P
67 This function is implemented via the
68 .B TIOCGSID
69 .BR ioctl (2),
70 present
71 since Linux 2.1.71.
72 .SH SEE ALSO
73 .BR getsid (2)