186d7f5d3SJohn Marino.\" Copyright (c) 1997 Peter Wemm <peter@FreeBSD.org> 286d7f5d3SJohn Marino.\" 386d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without 486d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions 586d7f5d3SJohn Marino.\" are met: 686d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright 786d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer. 886d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright 986d7f5d3SJohn Marino.\" notice, this list of conditions and the following disclaimer in the 1086d7f5d3SJohn Marino.\" documentation and/or other materials provided with the distribution. 1186d7f5d3SJohn Marino.\" 1286d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1386d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1486d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1586d7f5d3SJohn Marino.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1686d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1786d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1886d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1986d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2086d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2186d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2286d7f5d3SJohn Marino.\" SUCH DAMAGE. 2386d7f5d3SJohn Marino.\" 2486d7f5d3SJohn Marino.\" $FreeBSD: src/lib/libc/sys/getsid.2,v 1.3.2.5 2001/12/14 18:34:00 ru Exp $ 2586d7f5d3SJohn Marino.\" $DragonFly: src/lib/libc/sys/getsid.2,v 1.3 2007/06/30 19:03:52 swildner Exp $ 2686d7f5d3SJohn Marino.\" 2786d7f5d3SJohn Marino.Dd August 19, 1997 2886d7f5d3SJohn Marino.Dt GETSID 2 2986d7f5d3SJohn Marino.Os 3086d7f5d3SJohn Marino.Sh NAME 3186d7f5d3SJohn Marino.Nm getsid 3286d7f5d3SJohn Marino.Nd get process session 3386d7f5d3SJohn Marino.Sh LIBRARY 3486d7f5d3SJohn Marino.Lb libc 3586d7f5d3SJohn Marino.Sh SYNOPSIS 3686d7f5d3SJohn Marino.In unistd.h 3786d7f5d3SJohn Marino.Ft pid_t 3886d7f5d3SJohn Marino.Fn getsid "pid_t pid" 3986d7f5d3SJohn Marino.Sh DESCRIPTION 4086d7f5d3SJohn MarinoThe session ID of the process identified by 4186d7f5d3SJohn Marino.Fa pid 4286d7f5d3SJohn Marinois returned by 4386d7f5d3SJohn Marino.Fn getsid . 4486d7f5d3SJohn MarinoIf 4586d7f5d3SJohn Marino.Fa pid 4686d7f5d3SJohn Marinois zero, 4786d7f5d3SJohn Marino.Fn getsid 4886d7f5d3SJohn Marinoreturns the session ID of the current process. 4986d7f5d3SJohn Marino.Sh RETURN VALUES 5086d7f5d3SJohn MarinoUpon successful completion, the function 5186d7f5d3SJohn Marino.Fn getsid 5286d7f5d3SJohn Marinoreturns the session ID of 5386d7f5d3SJohn Marinothe specified process; otherwise, it returns a value of -1 and 5486d7f5d3SJohn Marinosets 5586d7f5d3SJohn Marino.Va errno 5686d7f5d3SJohn Marinoto indicate an error. 5786d7f5d3SJohn Marino.Sh ERRORS 5886d7f5d3SJohn Marino.Fn getsid 5986d7f5d3SJohn Marinowill succeed unless: 6086d7f5d3SJohn Marino.Bl -tag -width Er 6186d7f5d3SJohn Marino.It Bq Er ESRCH 6286d7f5d3SJohn Marinoif there is no process with a process ID equal to 6386d7f5d3SJohn Marino.Fa pid . 6486d7f5d3SJohn Marino.El 6586d7f5d3SJohn Marino.Pp 6686d7f5d3SJohn MarinoNote that an implementation may restrict this function call to 6786d7f5d3SJohn Marinoprocesses within the same session ID as the calling process. 6886d7f5d3SJohn Marino.Sh SEE ALSO 6986d7f5d3SJohn Marino.Xr getpgid 2 , 7086d7f5d3SJohn Marino.Xr getpgrp 2 , 7186d7f5d3SJohn Marino.Xr setpgid 2 , 7286d7f5d3SJohn Marino.Xr setsid 2 , 7386d7f5d3SJohn Marino.Xr termios 4 7486d7f5d3SJohn Marino.Sh HISTORY 7586d7f5d3SJohn MarinoThe 7686d7f5d3SJohn Marino.Fn getsid 7786d7f5d3SJohn Marinofunction call appeared in 7886d7f5d3SJohn Marino.Fx 3.0 . 7986d7f5d3SJohn MarinoThe 8086d7f5d3SJohn Marino.Fn getsid 8186d7f5d3SJohn Marinofunction call is derived from its usage in 8286d7f5d3SJohn Marino.At V . 83