getgrgid (BPX1GGI, BPX4GGI) — Access the group database by ID

Function

The getgrgid callable service gets information about a group and its members. You specify the group by the group ID (GID).

Requirements

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

AMODE 64 callers use BPX4GGI with the same parameters. The address returned is a fullword (below the bar).

Parameters

Group_ID
Supplied parameter
Type:
Integer
Length:
Fullword

The name of a fullword containing the ID of the group you want information about.

Return_value
Returned parameter
Type:
Address
Length:
Fullword

The name of a fullword in which the getgrgid service returns an address, or 0. If no entry for the specified group ID is found, Return_value is set to 0. If an entry is found, Return_value is set to the address of the BPXYGIDS macro. The first area contains the fullword length of the group name, followed by the group name padded with blanks. See BPXYGIDS — Map data returned for getgrnam and getgrpid.

If an entry is found and function code ThliEP_GidNameSet was set in ThliEP_FunctionCode prior to making this call, then Return_value is set to the address of the area in the BPXYTHLI where group name length and group name are set, as per the BPXYGIDS macro.

The address returned is 31 bits for both AMODE 31 and AMODE 64 callers.

Return_code
Returned parameter
Type:
Integer
Length:
Fullword
The name of a fullword in which the getgrgid service stores the return code. The getgrgid service returns Return_code only if Return_value is 0. See z/OS UNIX System Services Messages and Codes for a complete list of possible return code values. The getgrgid service can return one of the following values in the Return_code parameter:
Return_code Explanation
EMVSSAFEXTRERR The system authorization facility (SAF) RACROUTE EXTRACT service had an error.
EMVSSAF2ERR The (SAF) Get GMAP service had an error.
Reason_code
Returned parameter
Type:
Integer
Length:
Fullword

The name of a fullword in which the getgrgid service stores the reason code. The getgrgid service returns Reason_code only if Return_value is 0. 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 or EMVSSAFEXTRERR contains the RACF® return and reason codes, respectively, in the two low-order bytes.

For a more detailed description of the RACF Get GMAP service return and reason code values, see the following table:
RACF return code RACF reason code Explanation
8 4 If the search is by GID, the GID is not defined. If the search is by group name, the current group is not defined.
8 8 The group name is not defined.
8 12 There was an internal error during RACF processing.
8 16 Recovery could not be established.
8 20 The current group is incompletely defined.

Usage notes

  1. The return value points to data that may change or go away after the next getgrgid, getgrnam, or getgrent service request from that task. Each task manages its own storage separately. Move data to the program's storage if it is needed for future reference.
  2. The storage is key 0 nonfetch-protected storage that is managed by z/OS UNIX.
  3. Performance degradation can occur if you use this service when Virtual Lookaside Facility (VLF) is not active. For more information, see Tuning performance and the section on establishing UNIX security in z/OS UNIX System Services Planning.
  4. You can request to have just the group name of the specified GID returned instead of the group name and all of the members of the group. This will improve performance because just one group name look-up is done. To request this function, set the ThliEP_FunctionCode field with function code ThliEP_GIDNameSet prior to issuing the syscall. On successful return, the following values are set:
    • ThliEP_GIDNameLen is set to the length of the returned group name; valid values are 1-8.
    • ThliEP_GIDName is set to the group name of the specified GID.
    • ThliEP_GIDLen is always set to 4, the length of a GID.
    • ThliEP_GID is the GID specified on input.
    • ThliEP_GroupCount is always set to 0.

    Return_value is set to the output area. This is mapped by both the ThliExtendedGIDName structure in BPXYTHLI — Thread-level information, and by BPXYGIDS — Map data returned for getgrnam and getgrpid. If no entry for the specified group ID is found, Return_value is set to 0.

    The ThliEP_FunctionCode is cleared prior to returning to the caller; so, the invoker will need to set the ThliEp_FunctionCode before each invocation of the BPX1GGI/BPX4GGI service if the ThliEP_GIDNameSet function is to be used.

Related services

Characteristics and restrictions

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

Examples

For an example using this callable service, see BPX1GGI (getgrgid) example.