getsid(2) getsid(2)
NAME
getsid - get session ID
SYNOPSIS
#include <sys/types.h>
pidt getsid(pidt pid);
DESCRIPTION
The function getsid() returns the session ID of the process whose pro-
cess ID is equal to pid. If pid is equal to (pidt)0, getsid() returns
the session ID of the calling process.
Under the following conditions, the function getsid() fails and sets
errno to:
EPERM The process whose process ID is equal to pid is not in the
same session as the calling process, and the implementation
does not allow access to the session ID of that process from
the calling process.
ESRCH There is no process with a process ID equal to pid.
RESULT
Upon successful completion, the function getsid() returns the session
ID of the specified process; otherwise, it returns a value of
(pidt)-1 and sets errno to indicate an error.
SEE ALSO
exec(2), fork(2), getpid(2), setpgid(2), setsid(2).
Page 1 Reliant UNIX 5.44 Printed 11/98