162486687SUlrich Spörlein.\" 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.\" 25*a6d40b0aSGuilherme Janczak.Dd November 28, 2022 26d61f3de6SDavid Xu.Dt TCGETSID 3 27d61f3de6SDavid Xu.Os 28d61f3de6SDavid Xu.Sh NAME 29d61f3de6SDavid Xu.Nm tcgetsid 30d61f3de6SDavid Xu.Nd get session ID associated with a controlling terminal 31d61f3de6SDavid Xu.Sh LIBRARY 32d61f3de6SDavid Xu.Lb libc 33d61f3de6SDavid Xu.Sh SYNOPSIS 34d61f3de6SDavid Xu.In termios.h 35d61f3de6SDavid Xu.Ft pid_t 36d61f3de6SDavid Xu.Fn tcgetsid "int fd" 37d61f3de6SDavid Xu.Sh DESCRIPTION 38d61f3de6SDavid XuThe 39d61f3de6SDavid Xu.Fn tcgetsid 40d61f3de6SDavid Xufunction returns the process group ID of the session leader for a 41d61f3de6SDavid Xucontrolling terminal specified by 42d61f3de6SDavid Xu.Fa fd . 43d61f3de6SDavid Xu.Sh ERRORS 44d61f3de6SDavid XuIf an error occurs, 45d61f3de6SDavid Xu.Fn tcgetsid 46d61f3de6SDavid Xureturns -1 and the global variable 47d61f3de6SDavid Xu.Va errno 48d61f3de6SDavid Xuis set to indicate the error, as follows: 49d61f3de6SDavid Xu.Bl -tag -width Er 50d61f3de6SDavid Xu.It Bq Er EBADF 51d61f3de6SDavid XuThe 52d61f3de6SDavid Xu.Fa fd 53d61f3de6SDavid Xuargument is not a valid file descriptor. 54d61f3de6SDavid Xu.It Bq Er ENOTTY 55d61f3de6SDavid XuThe calling process does not have a controlling terminal or the 56d61f3de6SDavid Xuunderlying terminal device represented by 57d61f3de6SDavid Xu.Fa fd 58d61f3de6SDavid Xuis not the controlling terminal. 59d61f3de6SDavid Xu.El 60d61f3de6SDavid Xu.Sh SEE ALSO 61d61f3de6SDavid Xu.Xr getsid 2 , 62d61f3de6SDavid Xu.Xr setsid 2 , 6346b303e8SEd Schouten.Xr tcgetpgrp 3 , 6446b303e8SEd Schouten.Xr tcsetsid 3 65d61f3de6SDavid Xu.Sh STANDARDS 66d61f3de6SDavid XuThe 67d61f3de6SDavid Xu.Fn tcgetsid 68d61f3de6SDavid Xufunction conforms to 69d61f3de6SDavid Xu.St -xpg4.2 . 70