#include <sys/types.h>
pid_t setsid()
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. If the process had a controlling terminal, setsid() breaks the association between the process and that 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.
setsid() returns the process group ID of the calling process on success. On failure, it returns -1 and sets errno to indicate the error.
If any of the following conditions occur, setsid() returns -1 and sets errno to the corresponding value:
The process ID of the calling process equals the process group ID of a different process.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97