Blame man-pages-posix-2013-a/man3p/cfgetispeed.3p

Packit 7cfc04
'\" et
Packit 7cfc04
.TH CFGETISPEED "3P" 2013 "IEEE/The Open Group" "POSIX Programmer's Manual"
Packit 7cfc04
.SH PROLOG
Packit 7cfc04
This manual page is part of the POSIX Programmer's Manual.
Packit 7cfc04
The Linux implementation of this interface may differ (consult
Packit 7cfc04
the corresponding Linux manual page for details of Linux behavior),
Packit 7cfc04
or the interface may not be implemented on Linux.
Packit 7cfc04
Packit 7cfc04
.SH NAME
Packit 7cfc04
cfgetispeed
Packit 7cfc04
\(em get input baud rate
Packit 7cfc04
.SH SYNOPSIS
Packit 7cfc04
.LP
Packit 7cfc04
.nf
Packit 7cfc04
#include <termios.h>
Packit 7cfc04
.P
Packit 7cfc04
speed_t cfgetispeed(const struct termios *\fItermios_p\fP);
Packit 7cfc04
.fi
Packit 7cfc04
.SH DESCRIPTION
Packit 7cfc04
The
Packit 7cfc04
\fIcfgetispeed\fR()
Packit 7cfc04
function shall extract the input baud rate from the
Packit 7cfc04
.BR termios
Packit 7cfc04
structure to which the
Packit 7cfc04
.IR termios_p
Packit 7cfc04
argument points.
Packit 7cfc04
.P
Packit 7cfc04
This function shall return exactly the value in the
Packit 7cfc04
.BR termios
Packit 7cfc04
data structure, without interpretation.
Packit 7cfc04
.SH "RETURN VALUE"
Packit 7cfc04
Upon successful completion,
Packit 7cfc04
\fIcfgetispeed\fR()
Packit 7cfc04
shall return a value of type
Packit 7cfc04
.BR speed_t
Packit 7cfc04
representing the input baud rate.
Packit 7cfc04
.SH ERRORS
Packit 7cfc04
No errors are defined.
Packit 7cfc04
.LP
Packit 7cfc04
.IR "The following sections are informative."
Packit 7cfc04
.SH EXAMPLES
Packit 7cfc04
None.
Packit 7cfc04
.SH "APPLICATION USAGE"
Packit 7cfc04
None.
Packit 7cfc04
.SH RATIONALE
Packit 7cfc04
The term ``baud'' is used historically here, but is not technically
Packit 7cfc04
correct. This is properly ``bits per second'', which may not be the
Packit 7cfc04
same as baud. However, the term is used because of the historical
Packit 7cfc04
usage and understanding.
Packit 7cfc04
.P
Packit 7cfc04
The
Packit 7cfc04
\fIcfgetospeed\fR(),
Packit 7cfc04
\fIcfgetispeed\fR(),
Packit 7cfc04
\fIcfsetospeed\fR(),
Packit 7cfc04
and
Packit 7cfc04
\fIcfsetispeed\fR()
Packit 7cfc04
functions do not take arguments as numbers, but rather as symbolic
Packit 7cfc04
names. There are two reasons for this:
Packit 7cfc04
.IP " 1." 4
Packit 7cfc04
Historically, numbers were not used because of the way the rate was
Packit 7cfc04
stored in the data structure. This is retained even though a
Packit 7cfc04
function is now used.
Packit 7cfc04
.IP " 2." 4
Packit 7cfc04
More importantly, only a limited set of possible rates is at all
Packit 7cfc04
portable, and this constrains the application to that set.
Packit 7cfc04
.P
Packit 7cfc04
There is nothing to prevent an implementation accepting as an extension
Packit 7cfc04
a number (such as 126), and since the encoding of the Bxxx symbols is
Packit 7cfc04
not specified, this can be done to avoid introducing ambiguity.
Packit 7cfc04
.P
Packit 7cfc04
Setting the input baud rate to zero was a mechanism to allow for split
Packit 7cfc04
baud rates. Clarifications in this volume of POSIX.1\(hy2008 have made it possible to determine
Packit 7cfc04
whether split rates are supported and to support them without having to
Packit 7cfc04
treat zero as a special case. Since this functionality is also
Packit 7cfc04
confusing, it has been declared obsolescent.
Packit 7cfc04
The 0 argument referred to is the literal constant 0, not the symbolic
Packit 7cfc04
constant B0. This volume of POSIX.1\(hy2008 does not preclude B0 from being defined as the value
Packit 7cfc04
0; in fact, implementations would likely benefit from the two being
Packit 7cfc04
equivalent. This volume of POSIX.1\(hy2008 does not fully specify whether the previous
Packit 7cfc04
\fIcfsetispeed\fR()
Packit 7cfc04
value is retained after a
Packit 7cfc04
\fItcgetattr\fR()
Packit 7cfc04
as the actual value or as zero. Therefore, conforming applications should
Packit 7cfc04
always set both the input speed and output speed when setting either.
Packit 7cfc04
.P
Packit 7cfc04
In historical implementations, the baud rate information is
Packit 7cfc04
traditionally kept in
Packit 7cfc04
.BR c_cflag .
Packit 7cfc04
Applications should be written to presume that this might be the case
Packit 7cfc04
(and thus not blindly copy
Packit 7cfc04
.BR c_cflag ),
Packit 7cfc04
but not to rely on it in case it is in some other field of the
Packit 7cfc04
structure. Setting the
Packit 7cfc04
.BR c_cflag
Packit 7cfc04
field absolutely after setting a baud rate is a non-portable action
Packit 7cfc04
because of this. In general, the unused parts of the flag fields might
Packit 7cfc04
be used by the implementation and should not be blindly copied from the
Packit 7cfc04
descriptions of one terminal device to another.
Packit 7cfc04
.SH "FUTURE DIRECTIONS"
Packit 7cfc04
None.
Packit 7cfc04
.SH "SEE ALSO"
Packit 7cfc04
.IR "\fIcfgetospeed\fR\^(\|)",
Packit 7cfc04
.IR "\fIcfsetispeed\fR\^(\|)",
Packit 7cfc04
.IR "\fIcfsetospeed\fR\^(\|)",
Packit 7cfc04
.IR "\fItcgetattr\fR\^(\|)"
Packit 7cfc04
.P
Packit 7cfc04
The Base Definitions volume of POSIX.1\(hy2008,
Packit 7cfc04
.IR "Chapter 11" ", " "General Terminal Interface",
Packit 7cfc04
.IR "\fB<termios.h>\fP"
Packit 7cfc04
.SH COPYRIGHT
Packit 7cfc04
Portions of this text are reprinted and reproduced in electronic form
Packit 7cfc04
from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
Packit 7cfc04
-- Portable Operating System Interface (POSIX), The Open Group Base
Packit 7cfc04
Specifications Issue 7, Copyright (C) 2013 by the Institute of
Packit 7cfc04
Electrical and Electronics Engineers, Inc and The Open Group.
Packit 7cfc04
(This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
Packit 7cfc04
event of any discrepancy between this version and the original IEEE and
Packit 7cfc04
The Open Group Standard, the original IEEE and The Open Group Standard
Packit 7cfc04
is the referee document. The original Standard can be obtained online at
Packit 7cfc04
http://www.unix.org/online.html .
Packit 7cfc04
Packit 7cfc04
Any typographical or formatting errors that appear
Packit 7cfc04
in this page are most likely
Packit 7cfc04
to have been introduced during the conversion of the source files to
Packit 7cfc04
man page format. To report such errors, see
Packit 7cfc04
https://www.kernel.org/doc/man-pages/reporting_bugs.html .