]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/tcgetsid.3
7891d81f13affaa17e806ee5f9f839ca39c1162d
[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 2003-01-30 "GNU" "Linux Programmer's Manual"
24 .SH NAME
25 tcgetsid \- get session ID
26 .SH SYNOPSIS
27 .sp
28 .BR "#include <termios.h>"
29 .sp
30 .BI "pid_t tcgetsid(int " fd );
31 .SH DESCRIPTION
32 The function
33 .BR tcgetsid ()
34 returns the session ID of the current session that has the
35 terminal associated to
36 .I fd
37 as controlling terminal.
38 This terminal must be the controlling terminal of the calling process.
39 .SH "RETURN VALUE"
40 When
41 .I fd
42 refers to the controlling terminal of our session,
43 the function
44 .BR tcgetsid ()
45 will return the session ID of this session.
46 Otherwise, \-1 is returned, and
47 .I errno
48 is set appropriately.
49 .SH ERRORS
50 .TP
51 .B EBADF
52 .I fd
53 is not a valid file descriptor.
54 .TP
55 .B ENOTTY
56 The calling process does not have a controlling terminal, or
57 it has one but it is not described by
58 .IR fd .
59 .SH NOTES
60 This function is implemented via the TIOCGSID
61 .BR ioctl (2),
62 present
63 since Linux 2.1.71.
64 .SH "CONFORMING TO"
65 POSIX.1-2001
66 .SH "SEE ALSO"
67 .BR getsid (2)