getsid(2)

DESCRIPTION

Returns the session ID of the selected process. Zero selects the caller; a positive PID selects that process.

SYNOPSIS

long getsid(int64_t pid);

RETURN VALUE

  • Returns the session ID, or a negative errno.

ERRORS

  • -ESRCH
    • The selector is negative, overflows the PID domain, names no registered process, or there is no current process.

NOTES

Zombie processes remain selectable until reaped. The native query does not impose an additional permission check.