tcgetsid man page


This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

tcgetsid — get the process group ID for the session leader for the controlling terminal


#include <termios.h>

pid_t tcgetsid(int fildes);


The tcgetsid() function shall obtain the process group ID of the session for which the terminal specified by fildes is the controlling terminal.

Return Value

Upon successful completion, tcgetsid() shall return the process group ID of the session associated with the terminal. Otherwise, a value of -1 shall be returned and errno set to indicate the error.


The tcgetsid() function shall fail if:

The fildes argument is not a valid file descriptor.
The calling process does not have a controlling terminal, or the file is not the controlling terminal.

The following sections are informative.

See Also

The Base Definitions volume of POSIX.1‐2008, <termios.h>


2013 IEEE/The Open Group POSIX Programmer's Manual