getpgid (BPX1GEP, BPX4GEP) — Get the process group ID

Function

The getpgid callable service gets the process group ID of the process whose process ID is equal to the input process ID. If the input process ID is 0, getpgid returns the process group ID of the calling process.

Requirements

Operation Environment
Authorization: Supervisor or problem state, any PSW key
Dispatchable unit mode: Task
Cross memory mode: PASN = HASN
AMODE (BPX1GEP): 31-bit
AMODE (BPX4GEP): 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 BPX4GEP with the same parameter.

Parameters

PID
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the process ID for which to get the process group ID. If PID is 0, the process group ID of the calling process is returned.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the getpgid service returns a process group ID or, if it is not successful, a -1.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the getpgid service stores the return code. The getpgid 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 getpgid service can return one of the following values in the Return_code parameter:
Return_code Explanation
EPERM The process whose process ID is equal to PID is not in the same session as the calling process.
ESRCH There is no process with a process ID equal to PID.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

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

Examples

For an example using this callable service, see BPX1GEP (getpgid) example.