[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, 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 (exec: execl, execle, execlp, execv, execve, execvp, or exect Subroutine) subroutines, fork (fork, f_fork, or vfork Subroutine) subroutines, getpid (getpid, getpgrp, or getppid Subroutine) subroutines, setpgid subroutines.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]