NAME
cfgetospeed(), cfsetospeed(), cfgetispeed(), cfsetispeed() — tty baud rate functions
SYNOPSIS
#include <termios.h>
speed_t cfgetospeed(const struct termios *termios_p);
int cfsetospeed(struct termios *termios_p, speed_t speed);
speed_t cfgetispeed(const struct termios *termios_p);
int cfsetispeed(struct termios *termios_p, speed_t speed);
DESCRIPTION
These functions set and get the input and output speed codes in the
termios
structure referenced by
termios_p.
The
termios
structure contains these speed codes
representing input and output baud rates
as well as other terminal related parameters.
Setting the parameters on a terminal file
does not become effective until
tcsetattr()
is successfully called.
- cfgetospeed()
returns the output speed code from the
termios
structure referenced by
termios_p.
- cfsetospeed()
sets the output speed code in the
termios
structure referenced by
termios_p
to
speed.
The speed code for a baud rate of zero,
B0,
is used to terminate the connection.
If
B0
is specified, the modem control lines are no longer asserted,
which normally disconnects the line.
- cfgetispeed()
returns the input speed code from the
termios
structure referenced by
termios_p.
- cfsetispeed()
sets the input speed code in the
termios
structure referenced by
termios_p
to
speed.
RETURN VALUE
cfgetospeed()
returns the output speed code from the
termios
structure referenced by
termios_p.
cfgetispeed()
returns the input speed code from the
termios
structure referenced by
termios_p.
cfsetispeed()
and
cfsetospeed()
return zero upon successful completion.
Otherwise, they return -1 and set
errno
to indicate the error.
ERRORS
cfsetispeed()
and
cfsetospeed()
fail when the following condition is encountered:
- [EINVAL]
The value of
speed
is outside the range of possible speed codes as specified in
<termios.h>.
WARNINGS
cfsetispeed()
and
cfsetospeed()
can be used to set speed codes in the
termios
structure that are not supported by the terminal hardware.
STANDARDS CONFORMANCE
cfgetispeed(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1
cfgetospeed(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1
cfsetispeed(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1
cfsetospeed(): AES, SVID3, XPG3, XPG4, FIPS 151-2, POSIX.1