setsid(2) DG/UX R4.11MU05 setsid(2)
NAME
setsid - create session and set process group ID
SYNOPSIS
#include <sys/types.h>
pidt setsid ()
DESCRIPTION
If the calling process is not a process group leader, the setsid()
function shall create a new session. The calling process shall be
the session leader of this new session, shall be the process group
leader of a new process group, and shall have no controlling
terminal. The process group ID of the calling process shall be set
equal to the process ID of the calling process. The calling process
shall be the only process in the new process group and the only
process in the new session.
RETURN VALUE
Upon successful completion, the setsid() function returns the value
of the process group ID of the calling process.
DIAGNOSTICS
If any of the following conditions occur, the setsid() function shall
return -1 and set errno 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(2), exit(2), fork(2), getpid(2), kill(2) setpgid(2),
sigaction(2).
COPYRIGHTS
Portions of this text are reprinted from IEEE Std 1003.1-1988,
Portable Operating System Interface for Computer Environment,
copyright © 1988 by the Institute of Electrical and Electronics
Engineers, Inc., with the permission of the IEEE Standards
Department. To purchase IEEE Standards, call 800/678-IEEE.
In the event of a discrepancy between the electronic and the original
printed version, the original version takes precedence.
STANDARDS
The only way for a session to allocate a controlling terminal is for
the session leader (which must not already have a controlling
terminal) to open a terminal device that is not already associated
with any session, without using the O_NOCTTY option to open(). The
effect is that the processes in a session may have at most one
controlling terminal, and a terminal may have at most one controlling
process, which must be a session leader. When the controlling
process terminates, an automatic vhangup() occurs on the terminal and
its terminal characteristics are reset.
Licensed material--property of copyright holder(s)