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.

Note: In order to get the session ID of a process outside the calling process's session, your process must have the PROCMGR_AID_GETID ability enabled. For more information, see procmgr_ability().

Returns:

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

Errors:

EPERM
The process specified by pid isn't in the same session as the calling process, and the calling process doesn't have have the required permission; see procmgr_ability().
EINVAL
There isn't a process with the given ID.

Classification:

POSIX 1003.1

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