setsid(S) 6 January 1993 setsid(S) Name setsid - create session and set process ID Syntax cc . . . -lc #include <sys/types.h> pid_t setsid () Description If the calling process is not already a process group leader, the setsid routine creates a new session. After the routine is called, 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 pro- cess group ID of the calling process is set to the process ID of the cal- ling process. The calling process is the only process in the new process group and in the new session. Return value Upon successful completion, the setsid routine returns the value of the process group ID of the calling process. If the routine fails, setsid returns a value of -1 and errno is set to indicate the appropriate error. Diagnostics If the following condition occurs, the setsid routine fails and errno is set 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 conforms with: IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.