tcgetsid()

Get the process group ID of the session leader for a controlling terminal

Synopsis:

#include <termios.h>

pid_t tcgetsid( int fildes );

Arguments:

fildes
A file descriptor that's associated with the device whose 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 tcgetsid() function returns the process group ID of the session for which the terminal specified by fildes is the controlling terminal.

Returns:

The process group ID associated with the terminal, or -1 if an error occurred (errno is set).

Errors:

EACCES
The fildes argument isn't associated with a controlling terminal.
EBADF
The fildes argument isn't a valid file descriptor.
EINTR
The call was interrupted by a signal.
ENOTTY
The file associated with fildes isn't a terminal.

Classification:

POSIX 1003.1

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