1CFGETISPEED(P)             POSIX Programmer's Manual            CFGETISPEED(P)
2
3
4

NAME

6       cfgetispeed - get input baud rate
7

SYNOPSIS

9       #include <termios.h>
10
11       speed_t cfgetispeed(const struct termios *termios_p);
12
13

DESCRIPTION

15       The  cfgetispeed()  function shall extract the input baud rate from the
16       termios structure to which the termios_p argument points.
17
18       This function shall return exactly the value in the termios data struc‐
19       ture, without interpretation.
20

RETURN VALUE

22       Upon  successful completion, cfgetispeed() shall return a value of type
23       speed_t representing the input baud rate.
24

ERRORS

26       No errors are defined.
27
28       The following sections are informative.
29

EXAMPLES

31       None.
32

APPLICATION USAGE

34       None.
35

RATIONALE

37       The term "baud" is used historically here, but is not technically  cor‐
38       rect.  This is properly "bits per second", which may not be the same as
39       baud. However, the term is used because of  the  historical  usage  and
40       understanding.
41
42       The  cfgetospeed(),  cfgetispeed(),  cfsetospeed(),  and  cfsetispeed()
43       functions do not take arguments as  numbers,  but  rather  as  symbolic
44       names. There are two reasons for this:
45
46        1. Historically, numbers were not used because of the way the rate was
47           stored in the data structure. This is retained even though a  func‐
48           tion is now used.
49
50        2. More  importantly,  only  a limited set of possible rates is at all
51           portable, and this constrains the application to that set.
52
53       There is nothing to prevent an implementation accepting as an extension
54       a  number  (such as 126), and since the encoding of the Bxxx symbols is
55       not specified, this can be done to avoid introducing ambiguity.
56
57       Setting the input baud rate to zero was a mechanism to allow for  split
58       baud  rates. Clarifications in this volume of IEEE Std 1003.1-2001 have
59       made it possible to determine whether split rates are supported and  to
60       support them without having to treat zero as a special case. Since this
61       functionality is also confusing, it has been declared obsolescent.  The
62       0 argument referred to is the literal constant 0, not the symbolic con‐
63       stant B0. This volume of IEEE Std 1003.1-2001 does not preclude B0 from
64       being  defined  as  the  value 0; in fact, implementations would likely
65       benefit   from   the   two   being   equivalent.    This   volume    of
66       IEEE Std 1003.1-2001  does  not  fully  specify  whether  the  previous
67       cfsetispeed() value is retained after a tcgetattr() as the actual value
68       or  as  zero. Therefore, conforming applications should always set both
69       the input speed and output speed when setting either.
70
71       In historical implementations, the baud rate information is  tradition‐
72       ally  kept  in  c_cflag. Applications should be written to presume that
73       this might be the case (and thus not blindly copy c_cflag), but not  to
74       rely  on it in case it is in some other field of the structure. Setting
75       the c_cflag field absolutely after setting a baud rate is a  non-porta‐
76       ble  action  because  of this. In general, the unused parts of the flag
77       fields might be used by the implementation and should  not  be  blindly
78       copied from the descriptions of one terminal device to another.
79

FUTURE DIRECTIONS

81       None.
82

SEE ALSO

84       cfgetospeed()  , cfsetispeed() , cfsetospeed() , tcgetattr() , the Base
85       Definitions volume of IEEE Std 1003.1-2001, Chapter 11, General  Termi‐
86       nal Interface, <termios.h>
87
89       Portions  of  this text are reprinted and reproduced in electronic form
90       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
91       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
92       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
93       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
94       event of any discrepancy between this version and the original IEEE and
95       The  Open Group Standard, the original IEEE and The Open Group Standard
96       is the referee document. The original Standard can be  obtained  online
97       at http://www.opengroup.org/unix/online.html .
98
99
100
101IEEE/The Open Group                  2003                       CFGETISPEED(P)
Impressum