getsid()

Get the session ID of a process

Synopsis:

#include <unistd.h>

pid_t getsid( pid_t pid );

Arguments:

pid
The process ID for the process whose session ID you want to get.

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The getsid() function determines the session ID for the given process ID, pid.

Returns:

The session ID, or -1 if an error occurs (errno is set).

Errors:

EPERM
The process specified by pid is not in the same session as the calling process. The implementation doesn't allow access to the process group ID of the session leader from the calling process.
EINVAL
There isn't a process with the given ID.

Classification:

POSIX 1003.1 XSI

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

errno, setsid()