SETSID(S) UNIX System V SETSID(S)
Name
setsid - create session and set process ID
Syntax
#include <sys/types.h>
pid_t setsid ()
Description
If the calling process is not a process group leader, the
setsid() function creates a new session. The calling
process is the session leader of this new session, the
process group leader of a new process group, and has no
controlling terminal. The process group ID of the calling
process is set equal to the process ID of the calling
process. The calling process is the only process in the new
process group and the only process in the new session.
Return Value
Upon successful completion, setsid() returns the value of
the process group ID of the calling process. If any of the
following conditions occur, the setsid() function shall
return -1 and set errno to the corresponding value:
[EPERM] The calling process is already a process
group leader, or the process group ID of
a process other than the calling process
matches the process ID of the calling
process.
See Also
exec(S), exit(S), fork(S), getpid(S), kill(S), setpgid(S),
sigaction(S)
Standards Conformance
setsid is conformant with:
IEEE POSIX Std 1003.1-1988 with C Standard Language-
Dependent System Support;
and NIST FIPS 151-1.
(printed 6/20/89)