getgid, getegid or gegidx Subroutine

Purpose

Gets the process group IDs.

Library

Standard C Library (libc.a)

Syntax

#include <unistd.h>
#include <sys/types.h>
gid_t getgid (void);
gid_t getegid (void);
#include <id.h>
gid_t getgidx (int type);

Description

The getgid subroutine returns the real group ID of the calling process.

The getegid subroutine returns the effective group ID of the calling process.

The getgidx subroutine returns the group ID indicated by the type parameter of the calling process.

These subroutines are part of Base Operating System (BOS) Runtime.

Return Values

The getgid, getegidand getgidx subroutines return the requested group ID. The getgid and getegid subroutines are always successful.

The getgidx subroutine will return -1 and set the global errno variable to EINVAL if the type parameter is not one of ID_REAL, ID_EFFECTIVE or ID_SAVED.

Parameters

Item Description
type Specifies the group ID to get. Must be one of ID_REAL (real group ID), ID_EFFECTIVE (effective group ID) or ID_SAVED (saved set-group ID).

Error Codes

If the getgidx subroutine fails the following is returned:

Item Description
EINVAL Indicates the value of the type parameter is invalid.