+.\" Copyright (c) 1994 Christoph M. Robitschko
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Christoph M. Robitschko
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software withough specific prior written permission
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.Dd January 28, 1994
+.Dt SETSID 2
+.Os FreeBSD
+.Sh NAME
+.Nm setsid
+.Nd create session and set process group ID
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Ft pid_t
+.Fn setsid
+.Sh DESCRIPTION
+If the calling process is not a process group leader, the
+.Fn setsid
+function creates a new session and a new process group.
+The calling process is the session leader and process group leader, and
+has no controlling terminal.
+The ID of the process group is set to the process ID of the calling process.
+The calling process is the only member of the new session and of the new
+process group.
+.Sh RETURN VALUES
+.Fn Setsid
+returns the value of the new process group ID when the operation was successful.
+If the request failed, -1 is returned and the global variable
+.Va errno
+indicates the reason.
+.Sh ERRORS
+.Fn Setsid
+will fail if:
+.Bl -tag -width indent
+.It Bq Er EPERM
+The calling process is already a process group leader, or the process group ID
+of another process matches the process ID of the calling process.
+.El
+.Sh SEE ALSO
+.Xr getpid 2 ,
+.Xr setpgid 2
+.Sh STANDARDS
+.Fn Setpgid
+conforms to IEEE Std 1003.1-1988
+.Pq Dq Tn POSIX .