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