1*73be947eSjsg.\" $OpenBSD: tcgetsid.3,v 1.3 2023/01/12 12:56:07 jsg Exp $ 273c3eb76Smillert.\" 373c3eb76Smillert.\" Copyright (c) 1991 The Regents of the University of California. 473c3eb76Smillert.\" All rights reserved. 573c3eb76Smillert.\" 673c3eb76Smillert.\" Redistribution and use in source and binary forms, with or without 773c3eb76Smillert.\" modification, are permitted provided that the following conditions 873c3eb76Smillert.\" are met: 973c3eb76Smillert.\" 1. Redistributions of source code must retain the above copyright 1073c3eb76Smillert.\" notice, this list of conditions and the following disclaimer. 1173c3eb76Smillert.\" 2. Redistributions in binary form must reproduce the above copyright 1273c3eb76Smillert.\" notice, this list of conditions and the following disclaimer in the 1373c3eb76Smillert.\" documentation and/or other materials provided with the distribution. 1473c3eb76Smillert.\" 3. Neither the name of the University nor the names of its contributors 1573c3eb76Smillert.\" may be used to endorse or promote products derived from this software 1673c3eb76Smillert.\" without specific prior written permission. 1773c3eb76Smillert.\" 1873c3eb76Smillert.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 1973c3eb76Smillert.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2073c3eb76Smillert.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2173c3eb76Smillert.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2273c3eb76Smillert.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2373c3eb76Smillert.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2473c3eb76Smillert.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2573c3eb76Smillert.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2673c3eb76Smillert.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2773c3eb76Smillert.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2873c3eb76Smillert.\" SUCH DAMAGE. 2973c3eb76Smillert.\" 30*73be947eSjsg.Dd $Mdocdate: January 12 2023 $ 3173c3eb76Smillert.Dt TCGETSID 3 3273c3eb76Smillert.Os 3373c3eb76Smillert.Sh NAME 3473c3eb76Smillert.Nm tcgetsid 3573c3eb76Smillert.Nd get session ID associated with a controlling terminal 3673c3eb76Smillert.Sh SYNOPSIS 3773c3eb76Smillert.In termios.h 3873c3eb76Smillert.Ft pid_t 3973c3eb76Smillert.Fn tcgetsid "int fd" 4073c3eb76Smillert.Sh DESCRIPTION 4173c3eb76SmillertThe 4273c3eb76Smillert.Fn tcgetsid 4373c3eb76Smillertfunction returns the value of the session ID associated with the specified 4473c3eb76Smillertcontrolling terminal device. 4573c3eb76SmillertThe session ID is defined as the process group ID of the session leader. 4673c3eb76Smillert.Sh ERRORS 4773c3eb76SmillertIf an error occurs, 4873c3eb76Smillert.Fn tcgetsid 4973c3eb76Smillertreturns \-1 and the global variable 5073c3eb76Smillert.Va errno 5173c3eb76Smillertis set to indicate the error, as follows: 5273c3eb76Smillert.Bl -tag -width Er 5373c3eb76Smillert.It Bq Er EBADF 5473c3eb76SmillertThe 5573c3eb76Smillert.Fa fd 5673c3eb76Smillertargument is not a valid file descriptor. 5773c3eb76Smillert.It Bq Er ENOTTY 5873c3eb76SmillertThe calling process does not have a controlling terminal or the 5973c3eb76Smillertunderlying terminal device represented by 6073c3eb76Smillert.Fa fd 6173c3eb76Smillertis not the controlling terminal. 6273c3eb76Smillert.El 6373c3eb76Smillert.Sh SEE ALSO 6473c3eb76Smillert.Xr getsid 2 , 6573c3eb76Smillert.Xr setsid 2 , 6673c3eb76Smillert.Xr tcgetpgrp 3 6773c3eb76Smillert.Sh STANDARDS 6873c3eb76SmillertThe 6973c3eb76Smillert.Fn tcgetsid 70*73be947eSjsgfunction is compliant with the 7173c3eb76Smillert.St -p1003.1-2008 7273c3eb76Smillertspecification. 73f273b081Sschwarze.Sh HISTORY 74f273b081SschwarzeThe 75f273b081Sschwarze.Fn tcgetsid 76f273b081Sschwarzefunction has been available since 77f273b081Sschwarze.Ox 5.5 . 78