getsid (BPX1GES, BPX4GES) — Get the process group ID of the session leader

Function

The getsid callable service gets the process group ID of the session leader of the process whose process ID is equal to the input process ID. If the input process ID is 0, the service returns the process group ID of the session leader 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 (BPX1GES): 31-bit
AMODE (BPX4GES): 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 BPX1GES,(PID,
              Return_value,
              Return_code,
              Reason_code)

AMODE 64 callers use BPX4GES with the same parameter.

Parameters

PID
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the process ID that identifies the process whose session leader's process group ID should be obtained. If PID is 0, the process group ID of the calling process's session leader is returned.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

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

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the getsid service stores the return code. The getsid 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 getsid 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 getsid service stores the reason code. The getsid 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.

Related services

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1GES (getsid) example.