TCDRAIN

Section: Misc. Reference Manual Pages (3P)
Updated: August 1, 1992
Index Return to Main Contents
 

NAME

tcdrain, tcflow, tcflush, tcsendbreak - line control functions  

SYNOPSIS

#include <termios.h>

int tcdrain(int fildes);

int tcflow(int fildes, int action);

int tcflush(int fildes, int queue_selector);

int tcsendbreak(int fildes, int duration);
 

DESCRIPTION

The tcdrain function waits until all output written to the device referred to by fildes has been transmitted.

The tcflow function controls the flow of output, and attempts to control the flow of input, for the device referred to by fildes. The possible values of the action argument are the following constants defined in <termios.h>:

Constant
Description
TCOOFF
Suspend output from the device.
TCOON
Restart suspended output from the device.
TCIOFF
Transmit a STOP character, with the intention of stopping the terminal from sending any data.
TCION
Transmit a START character, with the intention of telling the terminal to restart the transmission of data.

The tcflush function discards any data written to the device referred by fildes but not transmitted, or data received, but not read, depending on the value of queue_selector. The possible values of the queue_selector are the following constants defined in <termios.h>:

Constant
Description
TCIFLUSH
Flush all data received but not yet read (input queue).
TCOFLUSH
Flush all data written but not yet transmitted (output queue).
TCIOFLUSH
Flush both the input and output queues.

The tcsendbreak causes the transmission of a break condition - a continuous stream of zero-valued bits. This occurs only if the file descriptor fildes is associated with a asynchronous communications line. The transmission lasts for 400 milliseconds.  

RETURN VALUE

Upon successful completion, a value of zero is returned. Otherwise a value of -1 is returned and errno is set to indicate the error.  

ERRORS

If any of the following conditions occur, tcdrain, tcflow, tcflush and tcsendbreak return -1 and sets errno to the corresponding value:
[EBADF]
The fildes argument is not a valid file descriptor.
[ENOTTY]
The file associated with fildes is not a terminal.

The following error condition may apply to tcdrain:

[EINTR]
A signal interrupted the function.

The following error condition may apply to tcflow:

[EINVAL]
The action argument is not a proper value.

The following error condition may apply to tcflush:

[EINVAL]
The queue_selector argument is not a proper value.
 

SEE ALSO

termios(4P)


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 17:22:15 GMT, March 25, 2025