xref: /freebsd/lib/libc/gen/tcsendbreak.3 (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
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. Neither the name of the University nor the names of its contributors
13.\"    may be used to endorse or promote products derived from this software
14.\"    without specific prior written permission.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26.\" SUCH DAMAGE.
27.\"
28.Dd January 11, 2017
29.Dt TCSENDBREAK 3
30.Os
31.Sh NAME
32.Nm tcsendbreak ,
33.Nm tcdrain ,
34.Nm tcflush ,
35.Nm tcflow
36.Nd line control functions
37.Sh LIBRARY
38.Lb libc
39.Sh SYNOPSIS
40.In termios.h
41.Ft int
42.Fn tcdrain "int fd"
43.Ft int
44.Fn tcflow "int fd" "int action"
45.Ft int
46.Fn tcflush "int fd" "int action"
47.Ft int
48.Fn tcsendbreak "int fd" "int len"
49.Sh DESCRIPTION
50The
51.Fn tcdrain
52function waits until all output written to the terminal referenced by
53.Fa fd
54has been transmitted to the terminal.
55.Pp
56The
57.Fn tcflow
58function suspends transmission of data to or the reception of data from
59the terminal referenced by
60.Fa fd
61depending on the value of
62.Fa action .
63The value of
64.Fa action
65must be one of the following:
66.Bl -tag -width "TCIOFF"
67.It Fa TCOOFF
68Suspend output.
69.It Fa TCOON
70Restart suspended output.
71.It Fa TCIOFF
72Transmit a STOP character, which is intended to cause the terminal to stop
73transmitting data to the system.
74(See the description of IXOFF in the
75.Ql Input Modes
76section of
77.Xr termios 4 ) .
78.It Fa TCION
79Transmit a START character, which is intended to cause the terminal to start
80transmitting data to the system.
81(See the description of IXOFF in the
82.Ql Input Modes
83section of
84.Xr termios 4 ) .
85.El
86.Pp
87The
88.Fn tcflush
89function discards any data written to the terminal referenced by
90.Fa fd
91which has not been transmitted to the terminal, or any data received
92from the terminal but not yet read, depending on the value of
93.Fa action .
94The value of
95.Fa action
96must be one of the following:
97.Bl -tag -width "TCIOFLUSH"
98.It Fa TCIFLUSH
99Flush data received but not read.
100.It Fa TCOFLUSH
101Flush data written but not transmitted.
102.It Fa TCIOFLUSH
103Flush both data received but not read and data written but not transmitted.
104.El
105.Pp
106The
107.Fn tcsendbreak
108function transmits a continuous stream of zero-valued bits for four-tenths
109of a second to the terminal referenced by
110.Fa fd .
111The
112.Fa len
113argument is ignored in this implementation.
114.Sh RETURN VALUES
115Upon successful completion, all of these functions return a value of zero.
116.Sh ERRORS
117If any error occurs, a value of -1 is returned and the global variable
118.Va errno
119is set to indicate the error, as follows:
120.Bl -tag -width Er
121.It Bq Er EBADF
122The
123.Fa fd
124argument is not a valid file descriptor.
125.It Bq Er EINVAL
126The
127.Fa action
128argument is not a proper value.
129.It Bq Er ENOTTY
130The file associated with
131.Fa fd
132is not a terminal.
133.It Bq Er EINTR
134A signal interrupted the
135.Fn tcdrain
136function.
137.It Bq Er EWOULDBLOCK
138The configured timeout expired before the
139.Fn tcdrain
140function could write all buffered output.
141.El
142.Sh SEE ALSO
143.Xr tcsetattr 3 ,
144.Xr termios 4 ,
145.Xr tty 4 ,
146.Xr comcontrol 8
147.Sh STANDARDS
148The
149.Fn tcsendbreak ,
150.Fn tcflush
151and
152.Fn tcflow
153functions are expected to be compliant with the
154.St -p1003.1-88
155specification.
156.Pp
157The
158.Fn tcdrain
159function is expected to be compliant with
160.St -p1003.1-88
161when the drain wait value is set to zero with
162.Xr comcontrol 8 ,
163or with
164.Xr ioctl 2
165.Va TIOCSDRAINWAIT ,
166or with
167.Xr sysctl 8
168.Va kern.tty_drainwait .
169A non-zero drain wait value can result in
170.Fn tcdrain
171returning
172.Va EWOULDBLOCK
173without writing all output.
174The default value for
175.Va kern.tty_drainwait
176is 300 seconds.
177