tcsetattr (BPX1TSA, BPX4TSA) — Set the attributes for a terminal

Function

The tcgetattr callable service sets control information for a terminal from the specified Termios_structure.

Requirements

Operation Environment
Authorization: Supervisor or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1TSA): 31-bit
AMODE (BPX4TSA): 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 BPX4TSA 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 for which attributes are to be set.

Actions
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword that contains indicators that control the setting of the attributes. The following possible values are defined in the BPXYTIOS macro; see BPXYTIOS — Map the termios structure.
Constant Description
TCSANOW Change the terminal attributes immediately.
TCSADRAIN Change the terminal attributes when all output to the terminal has been sent.
TCSAFLUSH Change the terminal attributes when all output to the terminal has been sent; and all input that has been received, but not read, is to be discarded.
Termios_structure
Supplied parameter
Type:
Structure
Length:
Specified by BPXYTIOS#LENGTH in the BPXYTIOS macro

The name of an area that contains the attributes that are to be set. Termios_structure is mapped by the BPXYTIOS macro. This structure contains the control modes, input modes, output modes, local modes, and special control characters. For the layout of the Termios_structure, see BPXYTIOS — Map the termios structure.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the tcsetattr 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 tcsetattr service stores the return code. The tcsetattr service returns Return_code only if Return_value is -1. For a complete list of possible return code values, see z/OS UNIX System Services Messages and Codes. The tcsetattr service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF File_descriptor is an incorrect open file descriptor.
EINTR A signal interrupted the call.
EINVAL An action or value that was 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.
EPERM A change was made that is not permitted from a slave pty. See Characteristics and restrictions.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the tcsetattr service stores the reason code. The tcsetattr 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

  1. A program should always issue the tcsetattr callable service using a termios structure that was returned from a previous call to tcgetattr (BPX1TGA, BPX4TGA) (see tcgetattr (BPX1TGA, BPX4TGA) — Get the attributes for a terminal), with appropriate changes to the various fields.
  2. The BPXYTIOS macro should be used to map the termios structure and define the equates for bits and values. Note the following about BPXYTIOS:
    • BPXYTIOS generates standard POSIX-defined names, except that all names are uppercase. In addition, all names can have a user-specified prefix.
    • When testing or setting bits in flag fields, you should use an offset name to define which byte in the flag field contains the bit. For instance: TM C_CFLAG+HUPCL_O,HUPCL.
    • CS5 through CS8 values can be contained in CSIZE. CSIZE is essentially a 2-bit integer that can contain decimal values 0 through 3, as defined by CS5 through CS8.
    • BPXYTIOS can be used to define either a DSECT or an inline structure. This is determined by the DSECT= keyword.
    • The C_CC field is an array of 1-byte fields, indexed by the various special character equates. These equates can be used as offsets into C_CC, or can be put into a register to be used with indexing instructions. For instance:
      MVC   C_CC+VSUSP,NEWVAL    To set a new value
      LA    R10,VSUSP            To set a register to use as an index
                                        in a later IC or STC instruction 
  3. The following table defines the processing of the SIGTTOU signal when the tcsetattr (BPX1TSA, BPX4TSA) service 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.

Characteristics and restrictions

  • The slave pty cannot set the PACKET, PKTXTND, or PKT3270 bits.
  • Neither the slave nor the master pty can set the PTU3270 bit if PKT3270 is not on.
  • The master pty cannot set the PKT3270 bit unless PKRXTND is also on.

Examples

For an example using this callable service, see BPX1TSA (tcsetattr) example.