tcgetsid(3C)
NAME
tcgetsid − Get session ID.
SYNOPSIS
#include <sys/types.h>
pid_t tcgetsid (fildes)
int fildes;
DESCRIPTION
tcgetsid returns the value of the session ID associated with the terminal device identified by fildes.
Certain restrictions apply to the use of this function:
1. Fildes must be the controlling terminal of the calling process.
2. This controlling terminal must be currently associated with the session of the calling process.
SEE ALSO
DIAGNOSTICS
Upon successful completion, the value of the obtained session ID is returned by tcgetsid. If not, a value of -1 is returned and errno is set to one of the following values:
[EBADF]
Fildes is not a valid open file descriptor.
[ENOTTY] Fildes is not associated with a terminal device or either the calling process or its session does not have a controlling terminal or the terminal device is not a controlling terminal.
CX/UX Programmer’s Reference Manual