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