getgroups (BPX1GGR, BPX4GGR) — Get a list of supplementary group IDs

Function

The getgroups callable service gets the number of supplementary group IDs (GIDs) for the calling process. It optionally gets a list of those supplementary group IDs.

Requirements

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

AMODE 64 callers use BPX4GGR with the same parameters. The Group_ID_list_pointer_address parameter is a doubleword.

Parameters

Group_ID_list_size
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword that specifies the number of fullword entries in the group ID list. This number must be at least as great as the total number of group IDs for the process, or must be 0.

If you specify 0, the program receives only a count of the actual number of group IDs for the calling process, and not a list of those IDs.

Group_ID_list_pointer_address
Supplied parameter
Type:
Address
Length:
Fullword (doubleword)

The name of a fullword (doubleword) that contains a pointer to a storage area in which the getgroups service is to place the list of supplementary group IDs. If Group_ID_list_size is specified as 0, Group_ID_list_pointer_address is ignored, and does not have to be set to a valid address. When the request is successful, the storage area is an array of fullwords, each containing a supplementary group ID for the calling process.

Number_of_group_IDs
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the getgroups service returns a number that represents a count of supplementary group IDs. A -1 is returned if an error is detected.
  • If Group_ID_list_size is specified as 0, the number is the total number of supplementary group IDs for the process.
  • If Group_ID_list_size is specified as greater than 0 and the request was successful, the number is the actual number of group IDs that were put into the area specified by Group_ID_list_pointer_address.
Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the getgroups service stores the return code. The getgroups service returns Return_code only if Number_of_group_IDs is -1. For a complete list of possible return code values, see z/OS UNIX System Services Messages and Codes. The getgroups service can return one of the following values in the Return_code parameter:
Return_code Explanation
EINVAL The Group_ID_list_size parameter was greater than 0 but less than the number of supplementary group IDs.
EMVSSAF2ERR System authorization facility (SAF) had an error.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the getgroups service stores the reason code. The getgroups service returns Reason_code only if Number_of_group_IDs 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 in the case of EMVSSAF2ERR contains the Resource Access Control Facility (RACF®) return and reason codes, respectively, in the two low-order bytes.

For a more detailed description of the RACF GETGRPS service return and reason code values, see the following table:
RACF Return Code RACF Reason Code Explanation
8 4 Group count is less than the number of supplemental groups
8 8 Invalid grouplist address
8 12 Internal error during RACF processing

Related services

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1GGR (getgroups) example.