1*8269e767SBrooks Davis.\" Copyright (c) 1997 Peter Wemm <peter@FreeBSD.org> 2*8269e767SBrooks Davis.\" 3*8269e767SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 4*8269e767SBrooks Davis.\" modification, are permitted provided that the following conditions 5*8269e767SBrooks Davis.\" are met: 6*8269e767SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 7*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 8*8269e767SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 9*8269e767SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 10*8269e767SBrooks Davis.\" documentation and/or other materials provided with the distribution. 11*8269e767SBrooks Davis.\" 12*8269e767SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 13*8269e767SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14*8269e767SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 15*8269e767SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 16*8269e767SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 17*8269e767SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 18*8269e767SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 19*8269e767SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 20*8269e767SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21*8269e767SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 22*8269e767SBrooks Davis.\" SUCH DAMAGE. 23*8269e767SBrooks Davis.\" 24*8269e767SBrooks Davis.Dd August 19, 1997 25*8269e767SBrooks Davis.Dt GETSID 2 26*8269e767SBrooks Davis.Os 27*8269e767SBrooks Davis.Sh NAME 28*8269e767SBrooks Davis.Nm getsid 29*8269e767SBrooks Davis.Nd get process session 30*8269e767SBrooks Davis.Sh LIBRARY 31*8269e767SBrooks Davis.Lb libc 32*8269e767SBrooks Davis.Sh SYNOPSIS 33*8269e767SBrooks Davis.In unistd.h 34*8269e767SBrooks Davis.Ft pid_t 35*8269e767SBrooks Davis.Fn getsid "pid_t pid" 36*8269e767SBrooks Davis.Sh DESCRIPTION 37*8269e767SBrooks DavisThe session ID of the process identified by 38*8269e767SBrooks Davis.Fa pid 39*8269e767SBrooks Davisis returned by 40*8269e767SBrooks Davis.Fn getsid . 41*8269e767SBrooks DavisIf 42*8269e767SBrooks Davis.Fa pid 43*8269e767SBrooks Davisis zero, 44*8269e767SBrooks Davis.Fn getsid 45*8269e767SBrooks Davisreturns the session ID of the current process. 46*8269e767SBrooks Davis.Sh RETURN VALUES 47*8269e767SBrooks DavisUpon successful completion, the 48*8269e767SBrooks Davis.Fn getsid 49*8269e767SBrooks Davissystem call 50*8269e767SBrooks Davisreturns the session ID of 51*8269e767SBrooks Davisthe specified process; otherwise, it returns a value of -1 and 52*8269e767SBrooks Davissets errno to indicate an error. 53*8269e767SBrooks Davis.Sh ERRORS 54*8269e767SBrooks DavisThe 55*8269e767SBrooks Davis.Fn getsid 56*8269e767SBrooks Davissystem call 57*8269e767SBrooks Daviswill succeed unless: 58*8269e767SBrooks Davis.Bl -tag -width Er 59*8269e767SBrooks Davis.It Bq Er ESRCH 60*8269e767SBrooks Davisif there is no process with a process ID equal to 61*8269e767SBrooks Davis.Fa pid . 62*8269e767SBrooks Davis.El 63*8269e767SBrooks Davis.Pp 64*8269e767SBrooks DavisNote that an implementation may restrict this system call to 65*8269e767SBrooks Davisprocesses within the same session ID as the calling process. 66*8269e767SBrooks Davis.Sh SEE ALSO 67*8269e767SBrooks Davis.Xr getpgid 2 , 68*8269e767SBrooks Davis.Xr getpgrp 2 , 69*8269e767SBrooks Davis.Xr setpgid 2 , 70*8269e767SBrooks Davis.Xr setsid 2 , 71*8269e767SBrooks Davis.Xr termios 4 72*8269e767SBrooks Davis.Sh HISTORY 73*8269e767SBrooks DavisThe 74*8269e767SBrooks Davis.Fn getsid 75*8269e767SBrooks Davissystem call appeared in 76*8269e767SBrooks Davis.Fx 3.0 . 77*8269e767SBrooks DavisThe 78*8269e767SBrooks Davis.Fn getsid 79*8269e767SBrooks Davissystem call is derived from its usage in 80*8269e767SBrooks Davis.At V . 81