]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/setsid.2
triggered by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283179
[thirdparty/man-pages.git] / man2 / setsid.2
1 .\" Copyright Michael Haardt (michael@cantor.informatik.rwth-aachen.de) Sat Aug 27 20:43:50 MET DST 1994
2 .\"
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
7 .\"
8 .\" The GNU General Public License's references to "object code"
9 .\" and "executables" are to be interpreted as the output of any
10 .\" document formatting or typesetting system, including
11 .\" intermediate and printed output.
12 .\"
13 .\" This manual is distributed in the hope that it will be useful,
14 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
15 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 .\" GNU General Public License for more details.
17 .\"
18 .\" You should have received a copy of the GNU General Public
19 .\" License along with this manual; if not, write to the Free
20 .\" Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111,
21 .\" USA.
22 .\"
23 .\" Modified Sun Sep 11 19:19:05 1994 <faith@cs.unc.edu>
24 .\" Modified Mon Mar 25 10:19:00 1996 <aeb@cwi.nl> (merged a few
25 .\" tiny changes from a man page by Charles Livingston).
26 .\" Modified Sun Jul 21 14:45:46 1996 <aeb@cwi.nl>
27 .\"
28 .TH SETSID 2 1994-08-27 "Linux 1.0.0" "Linux Programmer's Manual"
29 .SH NAME
30 setsid \- creates a session and sets the process group ID
31 .SH SYNOPSIS
32 .ad l
33 .B #include <unistd.h>
34 .sp
35 .B pid_t setsid(void);
36 .br
37 .ad b
38 .SH DESCRIPTION
39 \fBsetsid()\fP creates a new session if the calling process is not a
40 process group leader. The calling process is the leader of the new
41 session, the process group leader of the new process group, and has no
42 controlling tty. The process group ID and session ID of the calling
43 process are set to the PID of the calling process. The calling process
44 will be the only process in this new process group and in this new session.
45 .SH "RETURN VALUE"
46 The session ID of the calling process.
47 .SH ERRORS
48 On error, \-1 is returned, and
49 .I errno
50 is set.
51 The only error which can happen is
52 EPERM. It is returned when the process group ID of any process
53 equals the PID of the calling process. Thus, in particular,
54 .B setsid
55 fails if the calling process is already a process group leader.
56 .SH NOTES
57 A process group leader is a process with process group ID equal
58 to its PID. In order to be sure that
59 .B setsid
60 will succeed, fork and exit, and have the child do
61 .BR setsid().
62 .SH "CONFORMING TO"
63 POSIX, SVr4.
64 .SH "SEE ALSO"
65 .BR setpgid (2),
66 .BR setpgrp (2)