setgid (BPX1SGI, BPX4SGI) — Set the group ID

Function

The setgid callable service sets the real, effective, and saved set group IDs (GIDs) for the calling process.

Requirements

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

AMODE 64 callers use BPX4SGI 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 is to assume.

Return_value
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the setgid 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 setgid service stores the return code. The setgid 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 setgid 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 to set the group ID. Refer to Authorization for information about appropriate privileges.
EMVSSAF2ERR The SAF call IRRSSG00 incurred an error.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the setgid service stores the reason code. The setgid 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 SETGID 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, the real, saved set, and effective group IDs are set to Group_ID. Refer to Authorization for information about appropriate privileges.
  3. The setgid service does not change any supplementary group IDs of the calling process.

Related services

Characteristics and restrictions

Examples

For an example using this callable service, see BPX1SGI (setgid) example.