Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

OSS Library Calls (t - v) tcgetattr(3)
NAME
tcgetattr - Gets the attributes associated with a terminal
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <termios.h>
int tcgetattr(
int ledes,
struct termios *termios_p);
PARAMETERS
filedes Species an open le descriptor associated with a terminal.
termios_p Points to a termios structure.
DESCRIPTION
The tcgetattr( ) function gets the attributes associated with the object referenced by the ledes
parameter and stores them in the termios structure pointed to by the termios_p parameter.
The termios structure can contain baud rate information as follows:
If the terminal device supports input and output baud rates, then those elds in the ter-
mios structure reect the actual rate values, even when the rates are equal.
If the terminal device does not support differing baud rates, the value returned in the out-
put baud rate eld is the actual rate value.
If the device does not support split baud rates, the input baud rate stored in the termios
structure is 0 (zero).
The tcgetattr( ) function can be called from a foreground or background process.
RETURN VALUES
Upon successful completion, the value 0 (zero) is returned. Otherwise, the value -1 is returned
and errno is set to indicate the error.
ERRORS
If any of the following conditions occurs, the tcgetattr( ) function sets errno to the correspond-
ing value:
[EBADF] The ledes parameter is not a valid le descriptor.
[EFAULT] The system detected a bad address while processing a parameter of the function
call.
[EIO] An input/or output error occurred. The device holding the terminal le might be
in the down state, or both processors that provide access to the device might
have failed.
[EISGUARDIAN]
The value used for the ledes parameter is appropriate only in the Guardian
environment.
527187-007 Hewlett-Packard Company 711