SETSID(2P)SETSID(2P)NAME
setsid - (POSIX only) create session and set process group ID
SYNOPSIS
#include <sys/types.h>
pid_t setsid(void);
DESCRIPTION
The information in this specification applies only to POSIX
applications.
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 the 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 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
A successful call to setsid returns the value of the process group ID
of the calling process. A value of -1 indicates that an error
occurred, and the error code is stored in the global variable errno.
ERRORS
A possible error for setsid is:
[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 ALSOexecve(2), exit(2), fork(2), getpid(2), kill(2), setpgid(2P),
sigaction(2P)4.2 Berkeley Distribution August 1, 1992 SETSID(2P)