setsid (BPX1SSI, BPX4SSI) — Create a session and set the process group ID

Function

The setsid callable service creates a new session, with the calling process as its session leader. The caller becomes the group leader of a new process group.

Requirements

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

AMODE 64 callers use BPX4SSI with the same parameters.

Parameters

Session_ID
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword to which, if successful, the setsid service returns the session or process group ID of the new group. The new session or group process ID is the same as the process ID of the caller.

If not successful in creating a new session, the setsid service returns -1 as the Session_ID value.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the setsid service stores the return code. The setsid service returns Return_code only if Session_ID is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The setsid service can return one of the following values in the Return_code parameter:
Return_code Explanation
EPERM The caller is already a process group leader, or the caller's process ID matches the process group ID of some other process. The following reason code can accompany the return code: JRCallerIsPgLeader.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the setsid service stores the reason code. The setsid service returns Reason_code only if Session_ID 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

The calling process does not have a controlling terminal.

Related services

Characteristics and restrictions

The calling process must not already be a process group leader.

Examples

For an example using this callable service, see BPX1SSI (setsid) example.