xref: /freebsd/lib/libc/gen/tcgetsid.3 (revision d61f3de6567f0741ea8f28261732d9ce81073a59)
1d61f3de6SDavid Xu.\" Copyright (c) 2008 David Xu <davidxu@freebsd.org>
2d61f3de6SDavid Xu.\" All rights reserved.
3d61f3de6SDavid Xu.\"
4d61f3de6SDavid Xu.\" Redistribution and use in source and binary forms, with or without
5d61f3de6SDavid Xu.\" modification, are permitted provided that the following conditions
6d61f3de6SDavid Xu.\" are met:
7d61f3de6SDavid Xu.\" 1. Redistributions of source code must retain the above copyright
8d61f3de6SDavid Xu.\"    notice, this list of conditions and the following disclaimer.
9d61f3de6SDavid Xu.\" 2. Redistributions in binary form must reproduce the above copyright
10d61f3de6SDavid Xu.\"    notice, this list of conditions and the following disclaimer in the
11d61f3de6SDavid Xu.\"    documentation and/or other materials provided with the distribution.
12d61f3de6SDavid Xu.\"
13d61f3de6SDavid Xu.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
14d61f3de6SDavid Xu.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15d61f3de6SDavid Xu.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16d61f3de6SDavid Xu.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
17d61f3de6SDavid Xu.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18d61f3de6SDavid Xu.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19d61f3de6SDavid Xu.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20d61f3de6SDavid Xu.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21d61f3de6SDavid Xu.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22d61f3de6SDavid Xu.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23d61f3de6SDavid Xu.\" SUCH DAMAGE.
24d61f3de6SDavid Xu.\"
25d61f3de6SDavid Xu.\" $FreeBSD$
26d61f3de6SDavid Xu.\"
27d61f3de6SDavid Xu.Dd April 15, 2008
28d61f3de6SDavid Xu.Dt TCGETSID 3
29d61f3de6SDavid Xu.Os
30d61f3de6SDavid Xu.Sh NAME
31d61f3de6SDavid Xu.Nm tcgetsid
32d61f3de6SDavid Xu.Nd get session ID associated with a controlling terminal
33d61f3de6SDavid Xu.Sh LIBRARY
34d61f3de6SDavid Xu.Lb libc
35d61f3de6SDavid Xu.Sh SYNOPSIS
36d61f3de6SDavid Xu.In sys/types.h
37d61f3de6SDavid Xu.In termios.h
38d61f3de6SDavid Xu.Ft pid_t
39d61f3de6SDavid Xu.Fn tcgetsid "int fd"
40d61f3de6SDavid Xu.Sh DESCRIPTION
41d61f3de6SDavid XuThe
42d61f3de6SDavid Xu.Fn tcgetsid
43d61f3de6SDavid Xufunction returns the process group ID of the session leader for a
44d61f3de6SDavid Xucontrolling terminal specified by
45d61f3de6SDavid Xu.Fa fd .
46d61f3de6SDavid Xu.Sh ERRORS
47d61f3de6SDavid XuIf an error occurs,
48d61f3de6SDavid Xu.Fn tcgetsid
49d61f3de6SDavid Xureturns -1 and the global variable
50d61f3de6SDavid Xu.Va errno
51d61f3de6SDavid Xuis set to indicate the error, as follows:
52d61f3de6SDavid Xu.Bl -tag -width Er
53d61f3de6SDavid Xu.It Bq Er EBADF
54d61f3de6SDavid XuThe
55d61f3de6SDavid Xu.Fa fd
56d61f3de6SDavid Xuargument is not a valid file descriptor.
57d61f3de6SDavid Xu.It Bq Er ENOTTY
58d61f3de6SDavid XuThe calling process does not have a controlling terminal or the
59d61f3de6SDavid Xuunderlying terminal device represented by
60d61f3de6SDavid Xu.Fa fd
61d61f3de6SDavid Xuis not the controlling terminal.
62d61f3de6SDavid Xu.El
63d61f3de6SDavid Xu.Sh SEE ALSO
64d61f3de6SDavid Xu.Xr getsid 2 ,
65d61f3de6SDavid Xu.Xr setsid 2 ,
66d61f3de6SDavid Xu.Xr tcgetpgrp 3
67d61f3de6SDavid Xu.Sh STANDARDS
68d61f3de6SDavid XuThe
69d61f3de6SDavid Xu.Fn tcgetsid
70d61f3de6SDavid Xufunction conforms to
71d61f3de6SDavid Xu.St -xpg4.2 .
72