Gets the supplementary group ID of the current process.
Standard C Library (libc.a)
#include <sys/types.h> #include <unistd.h>
int getgroups (NGroups, GIDSet)
gid_t GIDSet [ ];
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.
|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:
|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.|
This subroutine is part of Base Operating System (BOS) Runtime.
The getgid (getgid or getegid Subroutine) subroutine, initgroups (initgroups Subroutine) subroutine, setgid subroutine, setgroups subroutine.
The groups command, setgroups command.
List of Security and Auditing Subroutines and Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.