tcgetpgrp (BPX1TGP, BPX4TGP) — Get the foreground process group ID

Function

The tcgetpgrp callable service gets the process group ID of the foreground process group that is associated with a terminal, which is identified by its file descriptor.

Requirements

Operation Environment
Authorization: Supervisor or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1TGP): 31-bit
AMODE (BPX4TGP): 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 BPX4TGP 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 tcgetpgrp service returns the process group ID of the foreground process group that is associated with the terminal, if the request is successful; or -1, if it is not successful. If there is no foreground process group, a positive value, not equal to any existing process group, is returned.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the tcgetpgrp service stores the return code. The tcgetpgrp 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 tcgetpgrp service can return one of the following values in the Return_code parameter:
Return_code Explanation
EBADF The File_descriptor parameter does not specify a valid open file descriptor.
ENOTTY The file descriptor is not associated with a terminal.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

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

Examples

For an example using this callable service, see BPX1TGP (tcgetpgrp) example.