setsid(2freebsd)

setsid2freebsd

Create session and set process group id

Usage

#include <unistd.h>

pid_t

setsid(void);

Library

Standard C Library (libc, -lc)

Overview

The setsid() system call 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.

Return values

Upon successful completion, the setsid() system call 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. If an error occurs, setsid() returns -1 and the global variable errno is set to indicate the error.

Errors

The setsid() system call 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.

Releases

9 releases since Debian 5.0 (Lenny); the text changed 6 times.

  1. 5.0
  2. 6.0
  3. 7
  4. 8
  5. 9
  6. 10
  7. 11–13

Standards

The setsid() system call is expected to be compliant with the ISO/IEC 9945-1:1990 (“POSIX.1”) specification.

From freebsd-manpages 12.2-2 in Debian 13 (Trixie). Parsed by carta from the page's mdoc source.