1TCDRAIN(3P) POSIX Programmer's Manual TCDRAIN(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 tcdrain — wait for transmission of output
13
15 #include <termios.h>
16
17 int tcdrain(int fildes);
18
20 The tcdrain() function shall block until all output written to the
21 object referred to by fildes is transmitted. The fildes argument is an
22 open file descriptor associated with a terminal.
23
24 Any attempts to use tcdrain() from a process which is a member of a
25 background process group on a fildes associated with its controlling
26 terminal, shall cause the process group to be sent a SIGTTOU signal.
27 If the calling thread is blocking SIGTTOU signals or the process is
28 ignoring SIGTTOU signals, the process shall be allowed to perform the
29 operation, and no signal is sent.
30
32 Upon successful completion, 0 shall be returned. Otherwise, -1 shall be
33 returned and errno set to indicate the error.
34
36 The tcdrain() function shall fail if:
37
38 EBADF The fildes argument is not a valid file descriptor.
39
40 EINTR A signal interrupted tcdrain().
41
42 EIO The process group of the writing process is orphaned, the call‐
43 ing thread is not blocking SIGTTOU, and the process is not
44 ignoring SIGTTOU.
45
46 ENOTTY The file associated with fildes is not a terminal.
47
48 The following sections are informative.
49
51 None.
52
54 None.
55
57 None.
58
60 None.
61
63 tcflush()
64
65 The Base Definitions volume of POSIX.1‐2017, Chapter 11, General Termi‐
66 nal Interface, <termios.h>
67
69 Portions of this text are reprinted and reproduced in electronic form
70 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
71 table Operating System Interface (POSIX), The Open Group Base Specifi‐
72 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
73 Electrical and Electronics Engineers, Inc and The Open Group. In the
74 event of any discrepancy between this version and the original IEEE and
75 The Open Group Standard, the original IEEE and The Open Group Standard
76 is the referee document. The original Standard can be obtained online
77 at http://www.opengroup.org/unix/online.html .
78
79 Any typographical or formatting errors that appear in this page are
80 most likely to have been introduced during the conversion of the source
81 files to man page format. To report such errors, see https://www.ker‐
82 nel.org/doc/man-pages/reporting_bugs.html .
83
84
85
86IEEE/The Open Group 2017 TCDRAIN(3P)