1.\" Copyright (c) 1994 Winning Strategies, Inc. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by Winning Strategies, Inc. 15.\" 4. The name of the author may not be used to endorse or promote products 16.\" derived from this software without specific prior written permission 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28.\" 29.\" $Id: setsid.2,v 1.1 1994/04/15 22:48:03 jtc Exp $ 30.\" 31.Dd April 15, 1994 32.Dt SETSID 2 33.Os 34.Sh NAME 35.Nm setsid 36.Nd set session ID 37.Sh SYNOPSIS 38.Fd #include <sys/types.h> 39.Fd #include <unistd.h> 40.Ft pid_t 41.Fn setsid 42.Sh DESCRIPTION 43If the current process is not a process group leader, 44.Fn setsid 45sets the process group ID and the session ID of the current process to 46the process ID of the current process, and releases the process's 47controlling terminal. 48.Sh RETURN VALUES 49Upon successful completion, the session ID of the current process is returned. 50Otherwise, a value of (pid_t) \-1 is returned and 51.Va errno 52is set to indicate the error. 53.Sh ERRORS 54.Fn setsid 55will fail and return an error if the following is true: 56.Bl -tag -width Er 57.It Bq Er EPERM 58The current process is already a process group leader, 59or there are other processes whose process group ID is equal to the 60process ID of the current process. 61.El 62.Sh SEE ALSO 63.Xr getpid 2 , 64.Xr setpgid 2 65.Sh STANDARDS 66.Fn setsid 67is expected to conform to 68.St -p1003.1-90 . 69