getsid() — get session ID
pid_t getsid (pid_t pid);
function returns the session ID of the specified process.
the call applies to the current process.
For this to be allowed,
the current process and the referenced
process must be in the same session.
The actions associated with this system call are subject to
compartmental restrictions. See
for more information about compartmentalization on systems that support
Compartmental restrictions can be overridden if the process possesses the
Processes owned by the superuser may not have this privilege.
Processes owned by any user may have this privilege, depending on system
for more information about privileged access on
systems that support fine-grained privileges.
Upon successful completion,
returns the session ID
of the specified process.
Otherwise, it returns a value of
to indicate the error.
to one of the following values:
The current process and the specified process are
not in the same session.
No process can be found corresponding to that