1 .\" Copyright (c) 1991, 1993
2 .\" The Regents of the University of California. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\" must display the following acknowledgement:
14 .\" This product includes software developed by the University of
15 .\" California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\" may be used to endorse or promote products derived from this software
18 .\" without specific prior written permission.
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .\" @(#)tcsetattr.3 8.3 (Berkeley) 1/2/94
33 .\" $FreeBSD: src/lib/libc/gen/tcsetattr.3,v 1.9 2001/10/01 16:08:51 ru Exp $
47 .Nd manipulating the termios structure
54 .Fa "const struct termios *termios_p"
58 .Fa "const struct termios *termios_p"
62 .Fa "struct termios *termios_p"
66 .Fa "struct termios *termios_p"
71 .Fa "struct termios *termios_p"
76 .Fa "struct termios *termios_p"
82 .Fa "struct termios *termios_p"
87 .Fa "int optional_actions"
88 .Fa "const struct termios *termios_p"
96 functions are provided for getting and setting the termios structure.
105 functions are provided for getting and setting the baud rate values in
106 the termios structure.
108 the effects of the functions on the terminal do not become effective,
109 nor are all errors detected, until the
112 Certain values for baud rates, set in the termios structure and passed to
114 have special meanings.
115 These are discussed in the portion of the manual page that describes the
118 .Sh GETTING AND SETTING THE BAUD RATE
119 The input and output baud rates are found in the termios structure.
122 is typedef'd in the include file
124 The value of the integer corresponds directly to the baud rate being
125 represented; however, the following symbolic values are defined:
143 #ifndef _POSIX_C_SOURCE
146 #endif /*_POSIX_C_SOURCE */
151 function returns the input baud rate in the termios structure referenced by
156 function sets the input baud rate in the termios structure referenced by
163 function returns the output baud rate in the termios structure referenced by
168 function sets the output baud rate in the termios structure referenced by
175 function sets both the input and output baud rate in the termios structure
181 Upon successful completion, the functions
187 Otherwise, a value of -1 is returned and the global variable
189 is set to indicate the error.
190 .Sh GETTING AND SETTING THE TERMIOS STATE
191 This section describes the functions that are used to control the general
193 Unless otherwise noted for a specific command, these functions are restricted
194 from use by background processes.
195 Attempts to perform these operations shall cause the process group to be sent
197 If the calling process is blocking or ignoring SIGTTOU signals, the process
198 is allowed to perform the operation and the SIGTTOU signal is not sent.
200 In all of the functions, although
202 is an open file descriptor, the functions affect the underlying terminal
203 file, not just the open file description that is associated
204 with the particular file descriptor.
208 function modifies the flags stored in the termios structure to a state disabling
209 all input and output processing, giving a
211 It should be noted that there is no function to reverse this effect.
212 Because a variety of processing options could be re-enabled,
213 the correct method is for an application to snapshot the
214 current terminal state using the function
216 setting raw mode with
220 and then using another
222 with the saved state to revert to the previous terminal state.
226 function copies the parameters associated with the terminal referenced
229 in the termios structure referenced by
231 This function is allowed from a background process;
232 however, the terminal attributes may be subsequently changed
233 by a foreground process.
237 function sets the parameters associated with the terminal from the
238 termios structure referenced by
244 the following values, as specified in the include file
246 .Bl -tag -width "TCSADRAIN"
248 The change occurs immediately.
250 The change occurs after all output written to
252 has been transmitted to the terminal.
255 should be used when changing parameters that affect output.
257 The change occurs after all output written to
259 has been transmitted to the terminal.
260 Additionally, any input that has been received but not read is discarded.
266 value, the values of the
274 The 0 baud rate is used to terminate the connection.
275 If 0 is specified as the output speed to the function
277 modem control will no longer be asserted on the terminal, disconnecting
280 If zero is specified as the input speed to the function
282 the input baud rate will be set to the same value as that specified by
283 the output baud rate.
287 is unable to make any of the requested changes, it returns -1 and
289 Otherwise, it makes all of the requested changes it can.
290 If the specified input and output baud rates differ and are a combination
291 that is not supported, neither baud rate is changed.
293 Upon successful completion, the functions
299 return -1 and the global variable
301 is set to indicate the error, as follows:
310 was not a valid file descriptor.
314 function was interrupted by a signal.
320 function was not valid, or an attempt was made to change an attribute
321 represented in the termios structure to an unsupported value.
323 The file associated with the
343 functions are expected to be compliant with the
355 function are extensions to the