aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man2/setsid.225
1 files changed, 17 insertions, 8 deletions
diff --git a/man2/setsid.2 b/man2/setsid.2
index 40a8fe98f0..52bc88e02d 100644
--- a/man2/setsid.2
+++ b/man2/setsid.2
@@ -1,5 +1,6 @@
.\" Copyright Michael Haardt (michael@cantor.informatik.rwth-aachen.de)
.\" Sat Aug 27 20:43:50 MET DST 1994
+.\" and Copyright (C) 2014, Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
.\" This is free documentation; you can redistribute it and/or
@@ -41,13 +42,15 @@ setsid \- creates a session and sets the process group ID
.BR setsid ()
creates a new session if the calling process is not a
process group leader.
-The calling process is the leader of the new
-session, the process group leader of the new process group, and has no
-controlling terminal.
-The process group ID and session ID of the calling
-process are set to the PID of the calling process.
+The calling process is the leader of the new session
+(i.e., its session ID is made the same as it process ID).
+The calling process also becomes
+the process group leader of a new process group in the session
+(i.e., its process group ID is made the same as it process ID).
+
The calling process will be the only process in
-this new process group and in this new session.
+the new process group and in the new session.
+The new session has no controlling terminal.
.SH RETURN VALUE
On success, the (new) session ID of the calling process is returned.
On error,
@@ -71,8 +74,14 @@ inherits its parent's session ID.
The session ID is preserved across an
.BR execve (2).
-A process group leader is a process with process group ID equal
-to its PID.
+A process group leader is a process whose process group ID equals its PID.
+Disallowing a process group leader from calling
+.BR setsid()
+prevents the possibility that a process group leader places itself
+in a new session while other processes in the process group remain
+in the original session;
+such a scenario would break the strict
+two-level hierarchy of sessions and process groups.
In order to be sure that
.BR setsid ()
will succeed,