isatty (BPX2ITY, BPX4ITY) (X/Open Version) — Determine whether a file descriptor represents a terminal

Function

The isatty callable service determines whether a file is a terminal.

Requirements

Operation Environment
Authorization: Supervisor state or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX2ITY): 31-bit
AMODE (BPX4ITY): 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

The syntax format is as follows:

AMODE 64 callers use BPX4ITY with the same parameter.

Parameters

File_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the file descriptor.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the isatty service returns 1 if File_descriptor is a terminal, or 0 if it is not a terminal.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the isatty service stores the return code. The isatty service may return Return_code only if Return_value is 0. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The isatty service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF The filedes argument is not a valid open file descriptor.
ENOTTY The filedes argument is not associated with a terminal.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

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

Usage notes

  1. This version of isatty is XPG4 compliant.
  2. This function does not return -1. If the file descriptor is not valid, a zero is returned.

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX2ITY (isatty) example.