148 lines
6.1 KiB
HTML
148 lines
6.1 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<html>
|
|
<head>
|
|
<meta name="generator" content="HTML Tidy, see www.w3.org">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 -->
|
|
<!-- Copyright (c) 2001 The Open Group, All Rights Reserved -->
|
|
<title>cfgetispeed</title>
|
|
</head>
|
|
<body bgcolor="white">
|
|
|
|
<basefont size="3"> <a name="cfgetispeed"></a> <a name="tag_03_65"></a><!-- cfgetispeed -->
|
|
<!--header start-->
|
|
<center><font size="2">The Open Group Base Specifications Issue 6<br>
|
|
IEEE Std 1003.1-2001<br>
|
|
Copyright © 2001 The IEEE and The Open Group, All Rights reserved.</font></center>
|
|
|
|
<!--header end-->
|
|
<hr size="2" noshade>
|
|
<h4><a name="tag_03_65_01"></a>NAME</h4>
|
|
|
|
<blockquote>cfgetispeed - get input baud rate</blockquote>
|
|
|
|
<h4><a name="tag_03_65_02"></a>SYNOPSIS</h4>
|
|
|
|
<blockquote class="synopsis">
|
|
<p><code><tt>#include <<a href="../basedefs/termios.h.html">termios.h</a>><br>
|
|
<br>
|
|
speed_t cfgetispeed(const struct termios *</tt><i>termios_p</i><tt>);<br>
|
|
</tt></code></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_03"></a>DESCRIPTION</h4>
|
|
|
|
<blockquote>
|
|
<p>The <i>cfgetispeed</i>() function shall extract the input baud rate from the <b>termios</b> structure to which the
|
|
<i>termios_p</i> argument points.</p>
|
|
|
|
<p>This function shall return exactly the value in the <b>termios</b> data structure, without interpretation.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_04"></a>RETURN VALUE</h4>
|
|
|
|
<blockquote>
|
|
<p>Upon successful completion, <i>cfgetispeed</i>() shall return a value of type <b>speed_t</b> representing the input baud
|
|
rate.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_05"></a>ERRORS</h4>
|
|
|
|
<blockquote>
|
|
<p>No errors are defined.</p>
|
|
</blockquote>
|
|
|
|
<hr>
|
|
<div class="box"><em>The following sections are informative.</em></div>
|
|
|
|
<h4><a name="tag_03_65_06"></a>EXAMPLES</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_07"></a>APPLICATION USAGE</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_08"></a>RATIONALE</h4>
|
|
|
|
<blockquote>
|
|
<p>The term "baud" is used historically here, but is not technically correct. This is properly "bits per second", which may not
|
|
be the same as baud. However, the term is used because of the historical usage and understanding.</p>
|
|
|
|
<p>The <a href="../functions/cfgetospeed.html"><i>cfgetospeed</i>()</a>, <i>cfgetispeed</i>(), <a href=
|
|
"../functions/cfsetospeed.html"><i>cfsetospeed</i>()</a>, and <a href="../functions/cfsetispeed.html"><i>cfsetispeed</i>()</a>
|
|
functions do not take arguments as numbers, but rather as symbolic names. There are two reasons for this:</p>
|
|
|
|
<ol>
|
|
<li>
|
|
<p>Historically, numbers were not used because of the way the rate was stored in the data structure. This is retained even though a
|
|
function is now used.</p>
|
|
</li>
|
|
|
|
<li>
|
|
<p>More importantly, only a limited set of possible rates is at all portable, and this constrains the application to that set.</p>
|
|
</li>
|
|
</ol>
|
|
|
|
<p>There is nothing to prevent an implementation accepting as an extension a number (such as 126), and since the encoding of the
|
|
Bxxx symbols is not specified, this can be done to avoid introducing ambiguity.</p>
|
|
|
|
<p>Setting the input baud rate to zero was a mechanism to allow for split baud rates. Clarifications in this volume of
|
|
IEEE Std 1003.1-2001 have made it possible to determine whether split rates are supported and to support them without
|
|
having to treat zero as a special case. Since this functionality is also confusing, it has been declared obsolescent. The 0
|
|
argument referred to is the literal constant 0, not the symbolic constant B0. This volume of IEEE Std 1003.1-2001 does
|
|
not preclude B0 from being defined as the value 0; in fact, implementations would likely benefit from the two being equivalent.
|
|
This volume of IEEE Std 1003.1-2001 does not fully specify whether the previous <a href=
|
|
"../functions/cfsetispeed.html"><i>cfsetispeed</i>()</a> value is retained after a <a href=
|
|
"../functions/tcgetattr.html"><i>tcgetattr</i>()</a> as the actual value or as zero. Therefore, conforming applications should
|
|
always set both the input speed and output speed when setting either.</p>
|
|
|
|
<p>In historical implementations, the baud rate information is traditionally kept in <b>c_cflag</b>. Applications should be written
|
|
to presume that this might be the case (and thus not blindly copy <b>c_cflag</b>), but not to rely on it in case it is in some
|
|
other field of the structure. Setting the <b>c_cflag</b> field absolutely after setting a baud rate is a non-portable action
|
|
because of this. In general, the unused parts of the flag fields might be used by the implementation and should not be blindly
|
|
copied from the descriptions of one terminal device to another.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_09"></a>FUTURE DIRECTIONS</h4>
|
|
|
|
<blockquote>
|
|
<p>None.</p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_10"></a>SEE ALSO</h4>
|
|
|
|
<blockquote>
|
|
<p><a href="cfgetospeed.html"><i>cfgetospeed</i>()</a> , <a href="cfsetispeed.html"><i>cfsetispeed</i>()</a> , <a href=
|
|
"cfsetospeed.html"><i>cfsetospeed</i>()</a> , <a href="tcgetattr.html"><i>tcgetattr</i>()</a> , the Base Definitions volume of
|
|
IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap11.html#tag_11">Chapter 11, General Terminal Interface</a>, <a href=
|
|
"../basedefs/termios.h.html"><i><termios.h></i></a></p>
|
|
</blockquote>
|
|
|
|
<h4><a name="tag_03_65_11"></a>CHANGE HISTORY</h4>
|
|
|
|
<blockquote>
|
|
<p>First released in Issue 3. Included for alignment with the POSIX.1-1988 standard.</p>
|
|
</blockquote>
|
|
|
|
<div class="box"><em>End of informative text.</em></div>
|
|
|
|
<hr>
|
|
<hr size="2" noshade>
|
|
<center><font size="2"><!--footer start-->
|
|
UNIX ® is a registered Trademark of The Open Group.<br>
|
|
POSIX ® is a registered Trademark of The IEEE.<br>
|
|
[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href=
|
|
"../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>
|
|
]</font></center>
|
|
|
|
<!--footer end-->
|
|
<hr size="2" noshade>
|
|
</body>
|
|
</html>
|
|
|