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
. SFor a list of return code values, see Return codes (errnos) in z/OS UNIX System Services Messages and Codes. 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 a list of reason codes, see Reason codes in z/OS UNIX System Services Messages and Codes.
Usage notes
The calling process does not have a controlling terminal.
Related services
- exec (BPX1EXC, BPX4EXC) — Run a program
- _exit (BPX1EXI, BPX4EXI) — End a process and bypass the cleanup
- fork (BPX1FRK, BPX4FRK) — Create a new process
- getpid (BPX1GPI, BPX4GPI) — Get the process ID
- kill (BPX1KIL, BPX4KIL) — Send a signal to a process
- setpgid (BPX1SPG, BPX4SPG) — Set a process group ID for job control
- sigaction (BPX1SIA, BPX4SIA) — Examine or change a signal action
Characteristics and restrictions
The calling process must not already be a process group leader.