Creates a session and sets the process group ID.
This function is supported on OpenVMS Integrity servers and
Alpha only.
Format
#include <unistd.h>
pid_t setsid (void);
1 – Description
The setsid function creates a new session if the calling process
is not a process group leader. Upon return, the calling process
is the session leader of this new session and the process
group leader of a new process group, and it 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.
This function requires that long (32-bit) UID/GID support be
enabled. See 32-Bit UID and GID Macro (Integrity servers, Alpha)
for more information.
2 – Return Values
x The process group ID of the calling process.
(pid_t)-1 Indicates an error. The function sets errno to
the following value:
o 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.