xref: /csrg-svn/lib/libc/sys/setsid.2 (revision 61185)
1*61185Sbostic.\" Copyright (c) 1991, 1993
2*61185Sbostic.\"	The Regents of the University of California.  All rights reserved.
352296Sbostic.\"
452296Sbostic.\" %sccs.include.redist.roff%
552296Sbostic.\"
6*61185Sbostic.\"	@(#)setsid.2	8.1 (Berkeley) 06/04/93
752296Sbostic.\"
852296Sbostic.Dd ""
952296Sbostic.Dt SETSID 2
1052296Sbostic.Os
1152296Sbostic.Sh NAME
1252296Sbostic.Nm setsid
1352296Sbostic.Nd create session and set process group ID
1452296Sbostic.Sh SYNOPSIS
1552296Sbostic.Fd #include <sys/types.h>
1652296Sbostic.Ft pid_t
1752296Sbostic.Fn setsid "void"
1852296Sbostic.Sh DESCRIPTION
1952296SbosticThe
2052296Sbostic.Nm setsid
2152296Sbosticfunction creates a new session.
2252296SbosticThe calling process is the session leader of the new session, is the
2352296Sbosticprocess group leader of a new process group and has no controlling
2452296Sbosticterminal.
2552296SbosticThe calling process is the only process in either the session or the
2652296Sbosticprocess group.
2752296Sbostic.Pp
2852296SbosticUpon successful completion, the
2952296Sbostic.Nm setsid
3052296Sbosticfunction returns the value of the process group ID of the new process
3152296Sbosticgroup, which is the same as the process ID of the calling process.
3252296Sbostic.Sh ERRORS
3352296SbosticIf an error occurs,
3452296Sbostic.Nm setsid
3552296Sbosticreturns -1 and the global variable
3652296Sbostic.Va errno
3752296Sbosticis set to indicate the error, as follows:
3852296Sbostic.Bl -tag -width Er
3952296Sbostic.It Bq Er EPERM
4052296SbosticThe calling process is already a process group leader, or the process
4152296Sbosticgroup ID of a process other than the calling process matches the process
4252296SbosticID of the calling process.
4352296Sbostic.El
4452296Sbostic.Sh SEE ALSO
4552296Sbostic.Xr setpgid 3 ,
4652296Sbostic.Xr tcgetpgrp 3 ,
4752296Sbostic.Xr tcsetpgrp 3
4852296Sbostic.Sh STANDARDS
4952296SbosticThe
5052296Sbostic.Nm setsid
5152296Sbosticfunction is expected to be compliant with the
5252296Sbostic.St -p1003.1-88
5352296Sbosticspecification.
54