setsid(S)
setsid --
create session and set process ID
Syntax
cc . . . -lc
#include <unistd.h>
pid_t setsid (void);
Description
If the calling process is not already a process group leader, the
setsid
routine creates a new session.
After the routine is called,
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. The process group ID
of the calling process is set to the process
ID of the calling process. The calling process is
the only process in the new process group and
in the new session.
Return value
Upon successful completion,
the
setsid
routine
returns the value of the process group
ID of the calling process.
If the routine fails,
setsid
returns a value of -1 and
errno
is set to indicate the appropriate error.
Diagnostics
If the following condition occurs,
the
setsid
routine fails and
errno
is set 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(S),
exit(S),
fork(S),
getpid(S),
kill(S),
setpgid(S),
sigaction(S)
Standards conformance
setsid conforms with:
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
;
and
NIST FIPS 151-1
.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003