Standards
Standards / Extensions |
C or C++ |
Dependencies |
XPG4.2
Single UNIX Specification, Version 3
|
both |
|
Format
#define _XOPEN_SOURCE_EXTENDED 1
#include <termios.h>
pid_t tcgetsid(int fildes);
General description
The tcgetsid()
obtains the process group ID of the session for which the terminal
specified by fildes is the controlling terminal.
Returned value
If successful, tcgetsid()
returns the process group ID associated with the terminal.
If
unsuccessful, tcgetsid() returns (pid_t)-1 and sets errno to one of
the following values:
- Error Code
- Description
- EACCES
- The fildes argument is not associated
with a controlling terminal. If the environment variable _EDC_SUSV3
is set to 1, ENOTTY will be returned instead of EACCES.
- EBADF
- The fildes argument is not a valid file
descriptor.
- ENOTTY
- The calling process does not have a controlling terminal, or the
file is not the controlling terminal.
Note: Starting with z/OS V1.9,
environment variable _EDC_SUSV3 can be used to control the behavior
of tcgetsid() with respect to setting errno to ENOTTY instead of EACCES.
By default, tcgetsid() will set EACESS when fildes is not associated
with a controlling terminal. When _EDC_SUSV3 is set to 1, setenv()
will set errno to ENOTTY in place of EACCES.