tcflush (BPX1TFH, BPX4TFH) — Flush input or output on a terminal

Function

The tcflush callable service flushes all data that is sent to a device. Depending on the value of the Queue_selector parameter, any data written, but not sent, or any data received, but not read, is discarded.

Requirements

Operation Environment
Authorization: Supervisor or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1TFH): 31-bit
AMODE (BPX4TFH): 64-bit
ASC mode: Primary mode
Interrupt status: Enabled for interrupts
Locks: Unlocked
Control parameters: All parameters must be addressable by the caller and in the primary address space.

Format

CALL BPX1TFH,(File_descriptor,
              Queue_selector,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4TFH with the same parameters.

Parameters

File_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the file descriptor of the terminal.

Queue_selector
Supplied parameter
Type:
Integer
Length:
Fullword
The name of a fullword that specifies the queues that are to be flushed. The constants are mapped in the BPXYTIOS macro; see BPXYTIOS — Map the termios structure.
Constant Description
TCIFLUSH Flush data received but not read
TCOFLUSH Flush data written but not sent
TCIOFLUSH Flush both data received but not read and data written but not sent
Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the tcflush service returns 0 if the request is successful, or -1 if it is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the tcflush service stores the return code. The tcflush service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The tcflush service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF File_descriptor is not a valid open file descriptor.
EINTR A signal interrupted the call.
EINVAL The Queue_selector specified was incorrect.
EIO The process group of the process that is issuing the function is an orphaned, background process group, and the process that is issuing the function is not ignoring or blocking SIGTTOU.
ENOTTY The file that is associated with the file descriptor is not a terminal.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the tcflush service stores the reason code. The tcflush service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. For the reason codes, see z/OS UNIX System Services Messages and Codes.

Usage notes

The following table defines the processing of the SIGTTOU signal when tcflush is called from a background process against a controlling terminal:

SIGTTOU processing Expected behavior
Default or signal handler

The SIGTTOU signal is generated.
The function is not performed.
Return_value is set to -1,
and Return_code is set to EINTR.

Ignored or blocked

The SIGTTOU signal is not sent.
The function continues normally.

Related services

Characteristics and restrictions

There are no restrictions on the use of the tcflush service.

Examples

For an example using this callable service, see BPX1TFH (tcflush) example.