Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

setsid(2) [ultrix man page]

setsid(2)							System Calls Manual							 setsid(2)

Name
       setsid - POSIX create session and set process group ID

Syntax
       #include <sys/types.h>
       pid_t
       setsid()

Description
       The  system call creates a new session, if the calling process is not a process group leader.  The calling process is the session leader of
       the new session, the process group leader of the new process group, and does not have a controlling terminal.  The process group ID of  the
       calling process is set equal to the process ID of the calling process.

Return Values
       Upon successful completion, the system call returns the value of the process group ID of the calling process.  If the system call fails, -1
       is returned, and the global variable errno indicates the reason.

Diagnostics
       The system call fails and a new session is not created if the following occurs:

       [EPERM]	      The calling process is already a process group leader.

		      The process group ID of a process other than the calling process matches the process ID of the calling process.

See Also
       getpgrp(2), setpgid(3)

																	 setsid(2)

Check Out this Related Man Page

SETSID(2)						      BSD System Calls Manual							 SETSID(2)

NAME
setsid -- create session and set process group ID SYNOPSIS
#include <sys/types.h> #include <unistd.h> pid_t setsid(void); DESCRIPTION
The setsid function creates a new session. The calling process is the session leader of the new session, is the process group leader of a new process group and has no controlling terminal. The calling process is the only process in either the session or the process group. Upon successful completion, the setsid function returns the value of the process group ID of the new process group, which is the same as the process ID of the calling process. ERRORS
If an error occurs, setsid returns -1 and the global variable errno is set to indicate the error, as follows: [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
setpgid(3), tcgetpgrp(3), tcsetpgrp(3) STANDARDS
The setsid function is expected to be compliant with the IEEE Std 1003.1-1988 (``POSIX.1'') specification. BSD
June 4, 1993 BSD
Man Page