set session ID
If the calling process is not already a process group leader,
setsid sets the process group ID and session
ID of the calling process to the process ID of
the calling process, and releases the process's controlling terminal.
On success, setsid returns the calling process's session
On failure, setsid returns -1 and sets errno to
identify the error.
In the following conditions, setsid fails and sets errno to:
The calling process is already a process group leader, or there are
processes other than the calling process whose process group ID
is equal to the process ID of the calling process.
If the calling process is the last member of a pipeline started by a job
control shell, the shell may make the calling process a process group leader.
The other processes of the pipeline become members of that process group.
In this case, the call to setsid will fail.
For this reason, a
process that calls setsid and expects to be part of a pipeline
should always first fork; the parent should exit and the child should
call setsid, thereby insuring that the process will work reliably
when started by both job control shells and non-job control shells.
Considerations for threads programming
This ID number is an attribute of the containing process
and is shared by sibling threads.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004