getsid(3)

DESCRIPTION

Returns the session ID of the selected process. pid zero selects the caller; a positive pid selects that process, including a zombie that has not yet been reaped.

SYNOPSIS

#include <unistd.h>

pid_t getsid(pid_t pid);

RETURN VALUE

  • Returns the session ID, or -1 and sets errno.

ERRORS

  • -ESRCH
    • Pid is negative, cannot be represented by the native PID domain, or names no registered process.

NOTES

Astia has no cross-process permission restriction for this query. A process remains selectable until its parent reaps it with waitpid.