[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

getsid Subroutine

Purpose

Returns the session ID of the calling process.

Library

(libc.a)

Syntax

#include <unistd.h>

pid_t getsid (pid_ t pid)

Description

The getsid subroutine returns the process group ID of the process that is the session leader of the process specified by pid. If pid is equal to pid_t subroutine, it specifies the calling process.

Parameters

pid A process ID of the process being queried.

Return Values

Upon successful completion, getsid subroutine returns the process group ID of the session leaded of the specified process. Otherwise, it returns (pid_t)-1 and set errno to indicate the error.

id The session ID of the requested process.
-1 Not successful and the errno global variable is set to one of the following error codes.

Error Codes

ESRCH There is no process with a process ID equal to pid.
EPERM The process specified by pid is not in the same session as the calling process.
ESRCH There is no process with a process ID equal to pid.

Related Information

The exec subroutines, fork subroutines, getpid subroutines, setpgid subroutines.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]