Gets the supplementary group ID of the current process.
Standard C Library (libc.a)
The getgroups subroutine gets the supplementary group ID of the process. The list is stored in the array pointed to by the GIDSet parameter. The NGroups parameter indicates the number of entries that can be stored in this array. The getgroups subroutine never returns more than the number of entries specified by the NGROUPS_MAX constant. (The NGROUPS_MAX constant is defined in the limits.h file.) If the value in the NGroups parameter is 0, the getgroups subroutine returns the number of groups in the supplementary group.
Item | Description |
---|---|
GIDSet | Points to the array in which the supplementary group ID of the user's process is stored. |
NGroups | Indicates the number of entries that can be stored in the array pointed to by the GIDSet parameter. |
Upon successful completion, the getgroups subroutine returns the number of elements stored into the array pointed to by the GIDSet parameter. If the getgroups subroutine is unsuccessful, a value of -1 is returned and the errno global variable is set to indicate the error.
The getgroups subroutine is unsuccessful if either of the following error codes is true:
Item | Description |
---|---|
EFAULT | The NGroups and GIDSet parameters specify an array that is partially or completely outside of the allocated address space of the process. |
EINVAL | The NGroups parameter is smaller than the number of groups in the supplementary group. |