The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 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, if the calling process is not a process group leader. Upon return the calling process will be the session leader of this new session, will be the process group leader of a new process group, and will have no controlling terminal. The process group ID of the calling process will be set equal to the process ID of the calling process. The calling process will be the only process in the new process group and the only process in the new session.

 RETURN VALUE

Upon successful completion, setsid() returns the value of the process group ID of the calling process. Otherwise it returns (pid_t)-1 and sets errno to indicate the error.

 ERRORS

The setsid() function will fail if:
[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.

 EXAMPLES

None.

 APPLICATION USAGE

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

getsid(), setpgid(), setpgrp(), <sys/types.h>, <unistd.h>.

DERIVATION

Derived from the POSIX.1-1988 standard.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]