unlockpt (BPX1UPT, BPX4UPT) — Unlock a pseudoterminal master/slave pair

Function

The unlockpt callable service unlocks the slave pseudoterminal device that is associated with the master to which the file descriptor refers.

Note: Because access to pseudoterminals is granted by changing ownership during the first slave open, and that caller must have the same UID as the master opener, neither the grantpt nor the unlockpt services are functionally required. They are provided in order to be compatible with XPG4, and for ported programs that may use them.

Requirements

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

AMODE 64 callers use BPX4UPT with the same parameters.

Parameters

File_descriptor
Supplied parameter
Type:
Integer
Length:
Fullword

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

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the unlockpt 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 unlockpt service stores the return code. The unlockpt 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 unlockpt service can return one of the following values in the Return_code parameter:
Return_code Explanation
EACCES Either a grantpt has not yet been issued, or an unlockpt has already been issued. An unlockpt must be issued after a grantpt, and can only be issued once.
EBADF The File_descriptor parameter does not specify a file descriptor that is open for writing.
EINVAL The file descriptor is not associated with a master pseudoterminal device.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

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

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1UPT (unlockpt) example.