TCDRAIN(3) SysV TCDRAIN(3)
NAME
tcdrain - wait for output to complete
SYNOPSIS
#include <termios.h>
int tcdrain (filedes)
int filedes;
DESCRIPTION
The tcdrain function waits until all output written to the object
referred to by the filedes argument has been transmitted. The filedes
argument specifies an open file descriptor associated with a terminal.
Attempts to use the tcdrain function from a process which is a member of
a background process group on a filedes associated with its controlling
terminal cause the process group to be sent a SIGTTOU signal. If the
calling process is blocking or ignoring SIGTTOU signals, the process is
allowed to perform the operation and no signal is sent.
EXAMPLE
To wait until all output has been transmitted, enter:
rc = tcdrain(1);
DIAGNOSTICS
Upon successful completion, a value of 0 (zero) is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
ERRORS
tcdrain fails if:
[EBADF] The filedes argument does not specify a valid file descriptor.
[EINTR] A signal interrupted the tcdrain() function.
[ENOTTY] The file associated with the filedes argument is not a
terminal.
SEE ALSO
tcflow(3), tcflush(3), tcsendbreak(3) termios(7)