]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/tcgetsid.3
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir...
[thirdparty/man-pages.git] / man3 / tcgetsid.3
CommitLineData
fea681da
MK
1.\" Copyright (C) 2002 Andries Brouwer <aeb@cwi.nl>
2.\"
93015253 3.\" %%%LICENSE_START(VERBATIM)
fea681da
MK
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.
c13182ef 12.\"
fea681da
MK
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.
c13182ef 20.\"
fea681da
MK
21.\" Formatted or processed versions of this manual, if unaccompanied by
22.\" the source, must acknowledge the copyright and authors of this work.
4b72fb64 23.\" %%%LICENSE_END
fea681da 24.\"
86b91fdf 25.TH TCGETSID 3 2010-09-10 "GNU" "Linux Programmer's Manual"
fea681da
MK
26.SH NAME
27tcgetsid \- get session ID
28.SH SYNOPSIS
86b91fdf 29.BR "#define _XOPEN_SOURCE 500" " /* See feature_test_macros(7) */"
cc4615cc 30.br
0daa9e92 31.B "#include <termios.h>"
fea681da
MK
32.sp
33.BI "pid_t tcgetsid(int " fd );
34.SH DESCRIPTION
35The function
63aa9df0 36.BR tcgetsid ()
fea681da
MK
37returns the session ID of the current session that has the
38terminal associated to
39.I fd
40as controlling terminal.
41This terminal must be the controlling terminal of the calling process.
47297adb 42.SH RETURN VALUE
fea681da
MK
43When
44.I fd
45refers to the controlling terminal of our session,
46the function
63aa9df0 47.BR tcgetsid ()
fea681da
MK
48will return the session ID of this session.
49Otherwise, \-1 is returned, and
50.I errno
51is set appropriately.
52.SH ERRORS
53.TP
54.B EBADF
55.I fd
56is not a valid file descriptor.
57.TP
58.B ENOTTY
59The calling process does not have a controlling terminal, or
60it has one but it is not described by
61.IR fd .
c343e74c
MK
62.SH VERSIONS
63.BR tcgetsid ()
64is provided in glibc since version 2.1.
47297adb 65.SH CONFORMING TO
44a2c328 66POSIX.1-2001.
fea681da 67.SH NOTES
097585ed
MK
68This function is implemented via the
69.B TIOCGSID
fb186734 70.BR ioctl (2),
1e321034 71present
fea681da 72since Linux 2.1.71.
47297adb 73.SH SEE ALSO
fea681da 74.BR getsid (2)