1
0
Files
irix-657m-src/eoe/man/man2/setsid.2
2022-09-29 17:59:04 +03:00

51 lines
1.9 KiB
Groff

'\"macro stdmacro
.if n .pH g2.setsid @(#)setsid 40.15 of 4/5/91
.\" Copyright 1991 UNIX System Laboratories, Inc.
.\" Copyright 1989, 1990 AT&T
.nr X
.if \nX=0 .ds x} setsid 2 "" "\&"
.if \nX=1 .ds x} setsid 2 ""
.if \nX=2 .ds x} setsid 2 "" "\&"
.if \nX=3 .ds x} setsid "" "" "\&"
.TH \*(x}
.SH NAME
\f4setsid\f1 \- set session ID
.SH SYNOPSIS
\f4#include <sys/types.h>\f1
.br
\f4#include <unistd.h>\f1
.PP
\f4pid_t setsid(void);\f1
.SH DESCRIPTION
If the calling process is not already a process group leader, \f4setsid\fP sets the
\%process group ID and session ID of the calling process to the process ID of
the calling process, and releases the process's controlling terminal.
.PP
\f4setsid\fP will fail and return an error if the following is true:
.TP 15
\f4EPERM\fP
The calling process is already a process group leader, or there are processes other
than the calling process whose process group ID is equal to the process ID
of the calling process.
.SH SEE ALSO
\f4intro\fP(2),
\f4exec\fP(2), \f4exit\fP(2), \f4fork\fP(2), \f4getpid\fP(2), \f4getpgid\fP(2), \f4getsid\fP(2),
\f4setpgid\fP(2), \f4setpgrp\fP, \f4signal\fP(2), \f4sigsend\fP(2),
\f4sigaction\fP(2).
.SH NOTES
If the calling process is the last member of a pipeline started by a job
control shell, the shell may make the calling process a process group leader.
The other processes of the pipeline become members of that process group.
In this case, the call to \f4setsid\fP will fail. For this reason, a
process that calls \f4setsid\fP and expects to be part of a pipeline
should always first fork; the parent should exit and the child should
call \f4setsid\fP, thereby insuring that the process will work reliably
when started by both job control shells and non-job control shells.
.SH DIAGNOSTICS
Upon successful completion, \f4setsid\fP returns the calling process's session
.SM ID\*S.
Otherwise, a
value of -1 is returned and \f4errno\fP is set to indicate the error.
.\" @(#)setsid.2 6.2 of 9/6/83
.Ee