]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/tcgetsid.3
Even when the CONFORMING TO section is just a list of standards,
[thirdparty/man-pages.git] / man3 / tcgetsid.3
1 .\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2 .\"
3 .\" Permission is granted to make and distribute verbatim copies of this
4 .\" manual provided the copyright notice and this permission notice are
5 .\" preserved on all copies.
6 .\"
7 .\" Permission is granted to copy and distribute modified versions of this
8 .\" manual under the conditions for verbatim copying, provided that the
9 .\" entire resulting derived work is distributed under the terms of a
10 .\" permission notice identical to this one.
11 .\"
12 .\" Since the Linux kernel and libraries are constantly changing, this
13 .\" manual page may be incorrect or out-of-date. The author(s) assume no
14 .\" responsibility for errors or omissions, or for damages resulting from
15 .\" the use of the information contained herein. The author(s) may not
16 .\" have taken the same level of care in the production of this manual,
17 .\" which is licensed free of charge, as they might when working
18 .\" professionally.
19 .\"
20 .\" Formatted or processed versions of this manual, if unaccompanied by
21 .\" the source, must acknowledge the copyright and authors of this work.
22 .\"
23 .TH TCGETSID 3 2008-06-14 "GNU" "Linux Programmer's Manual"
24 .SH NAME
25 tcgetsid \- get session ID
26 .SH SYNOPSIS
27 .B #define _XOPEN_SOURCE 500
28 .br
29 .B "#include <termios.h>"
30 .sp
31 .BI "pid_t tcgetsid(int " fd );
32 .SH DESCRIPTION
33 The function
34 .BR tcgetsid ()
35 returns the session ID of the current session that has the
36 terminal associated to
37 .I fd
38 as controlling terminal.
39 This terminal must be the controlling terminal of the calling process.
40 .SH "RETURN VALUE"
41 When
42 .I fd
43 refers to the controlling terminal of our session,
44 the function
45 .BR tcgetsid ()
46 will return the session ID of this session.
47 Otherwise, \-1 is returned, and
48 .I errno
49 is set appropriately.
50 .SH ERRORS
51 .TP
52 .B EBADF
53 .I fd
54 is not a valid file descriptor.
55 .TP
56 .B ENOTTY
57 The calling process does not have a controlling terminal, or
58 it has one but it is not described by
59 .IR fd .
60 .SH VERSIONS
61 .BR tcgetsid ()
62 is provided in glibc since version 2.1.
63 .SH "CONFORMING TO"
64 POSIX.1-2001.
65 .SH NOTES
66 This function is implemented via the
67 .B TIOCGSID
68 .BR ioctl (2),
69 present
70 since Linux 2.1.71.
71 .SH "SEE ALSO"
72 .BR getsid (2)