getsid(2)

getsid2

Get process session

Usage

#include <unistd.h>

pid_t

getsid(pid_t pid);

Library

Standard C Library (libc, -lc)

Overview

The session ID of the process identified by pid is returned by getsid(). If pid is zero, getsid() returns the session ID of the current process.

Return values

Upon successful completion, the function getsid() returns the session ID of the specified process; otherwise, it returns a value of -1 and sets errno to indicate an error.

Errors

The getsid() system call will fail if:

[ESRCH]

There is no process with a process ID equal to pid.

Note that an implementation may restrict this function call to processes within the same session ID as the calling process.

Releases

147 releases since Mac OS X 10.2; the text changed 1 time.

  1. 10.2–10.4.11
  2. 10.5–26.5

History

The getsid() function call appeared in FreeBSD 3.0. The getsid() function call is derived from its usage in AT&T System V UNIX.

From xnu 12377.121.6 in macOS 26.5. Parsed by carta from the page's mdoc source.