setegid (BPX1SEG, BPX4SEG) — Set the effective group ID

Function

The setegid callable service sets the effective group ID (GID) of a process.

Requirements

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

Parameters

Group_ID
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that contains the group ID that the calling process wishes to assume.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the setegid service returns 0 if the request is successful, or -1 if it is not successful.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the setegid service stores the return code. The setegid service returns Return_code only if Return_value is -1. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The setegid service can return one of the following values in the Return_code parameter:
Return_code Explanation
EINVAL The Group_ID that was specified is incorrect.
EPERM The process does not have the appropriate privileges (see Authorization) to set the group ID.
EMVSSAF2ERR The SAF call IRRSEG00 incurred an error.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the setegid service stores the reason code. The setegid 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. The reason code for EMVSSAF2ERR contains the RACF® return and reason codes, respectively, in the two low-order bytes. For a more detailed description of the RACF SETEGID service return and reason code values, see the following table:
RACF return code RACF reason code Explanation
8 4 GID is not defined to RACF
8 8 User not authorized to change GID
8 12 Internal error during RACF processing
8 16 Unable to establish recovery

Usage notes

  1. If Group_ID is equal to the real group ID or saved set group ID of the process, the effective group ID is set to Group_ID.
  2. If Group_ID is not the same as the real group ID, and the calling process has the appropriate privileges (see Authorization), the effective group ID is set to Group_ID.
  3. The setegid service does not change any supplementary group IDs of the calling process.

Characteristics and restrictions

  • If the setegid service is issued from multiple tasks within one address space, use synchronization to ensure that the setegid services are not performed concurrently. The execution of setegid service calls concurrently within one address space can yield unpredictable results.
  • If the setegid service is issued from an address space with multiple processes, the result of the service call affects all processes in the address space.

Examples

For an example using this callable service, see BPX1SEG (setegid) example.