xref: /freebsd/lib/libc/gen/tcsendbreak.3 (revision ee12faa062c04a49bf6fe4e6867bad8606e2413f)
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.\"	@(#)tcsendbreak.3	8.1 (Berkeley) 6/4/93
29.\"
30.Dd January 11, 2017
31.Dt TCSENDBREAK 3
32.Os
33.Sh NAME
34.Nm tcsendbreak ,
35.Nm tcdrain ,
36.Nm tcflush ,
37.Nm tcflow
38.Nd line control functions
39.Sh LIBRARY
40.Lb libc
41.Sh SYNOPSIS
42.In termios.h
43.Ft int
44.Fn tcdrain "int fd"
45.Ft int
46.Fn tcflow "int fd" "int action"
47.Ft int
48.Fn tcflush "int fd" "int action"
49.Ft int
50.Fn tcsendbreak "int fd" "int len"
51.Sh DESCRIPTION
52The
53.Fn tcdrain
54function waits until all output written to the terminal referenced by
55.Fa fd
56has been transmitted to the terminal.
57.Pp
58The
59.Fn tcflow
60function suspends transmission of data to or the reception of data from
61the terminal referenced by
62.Fa fd
63depending on the value of
64.Fa action .
65The value of
66.Fa action
67must be one of the following:
68.Bl -tag -width "TCIOFF"
69.It Fa TCOOFF
70Suspend output.
71.It Fa TCOON
72Restart suspended output.
73.It Fa TCIOFF
74Transmit a STOP character, which is intended to cause the terminal to stop
75transmitting data to the system.
76(See the description of IXOFF in the
77.Ql Input Modes
78section of
79.Xr termios 4 ) .
80.It Fa TCION
81Transmit a START character, which is intended to cause the terminal to start
82transmitting data to the system.
83(See the description of IXOFF in the
84.Ql Input Modes
85section of
86.Xr termios 4 ) .
87.El
88.Pp
89The
90.Fn tcflush
91function discards any data written to the terminal referenced by
92.Fa fd
93which has not been transmitted to the terminal, or any data received
94from the terminal but not yet read, depending on the value of
95.Fa action .
96The value of
97.Fa action
98must be one of the following:
99.Bl -tag -width "TCIOFLUSH"
100.It Fa TCIFLUSH
101Flush data received but not read.
102.It Fa TCOFLUSH
103Flush data written but not transmitted.
104.It Fa TCIOFLUSH
105Flush both data received but not read and data written but not transmitted.
106.El
107.Pp
108The
109.Fn tcsendbreak
110function transmits a continuous stream of zero-valued bits for four-tenths
111of a second to the terminal referenced by
112.Fa fd .
113The
114.Fa len
115argument is ignored in this implementation.
116.Sh RETURN VALUES
117Upon successful completion, all of these functions return a value of zero.
118.Sh ERRORS
119If any error occurs, a value of -1 is returned and the global variable
120.Va errno
121is set to indicate the error, as follows:
122.Bl -tag -width Er
123.It Bq Er EBADF
124The
125.Fa fd
126argument is not a valid file descriptor.
127.It Bq Er EINVAL
128The
129.Fa action
130argument is not a proper value.
131.It Bq Er ENOTTY
132The file associated with
133.Fa fd
134is not a terminal.
135.It Bq Er EINTR
136A signal interrupted the
137.Fn tcdrain
138function.
139.It Bq Er EWOULDBLOCK
140The configured timeout expired before the
141.Fn tcdrain
142function could write all buffered output.
143.El
144.Sh SEE ALSO
145.Xr tcsetattr 3 ,
146.Xr termios 4 ,
147.Xr tty 4 ,
148.Xr comcontrol 8
149.Sh STANDARDS
150The
151.Fn tcsendbreak ,
152.Fn tcflush
153and
154.Fn tcflow
155functions are expected to be compliant with the
156.St -p1003.1-88
157specification.
158.Pp
159The
160.Fn tcdrain
161function is expected to be compliant with
162.St -p1003.1-88
163when the drain wait value is set to zero with
164.Xr comcontrol 8 ,
165or with
166.Xr ioctl 2
167.Va TIOCSDRAINWAIT ,
168or with
169.Xr sysctl 8
170.Va kern.tty_drainwait .
171A non-zero drain wait value can result in
172.Fn tcdrain
173returning
174.Va EWOULDBLOCK
175without writing all output.
176The default value for
177.Va kern.tty_drainwait
178is 300 seconds.
179