getgroups(2)
NAME
getgroups − get group access list
SYNTAX
#include <sys/param.h>
getgroups(gidsetsize, gidset)
int gidsetsize, *gidset;
DESCRIPTION
The getgroups call gets the current group access list of the user process and stores it in the array gidset. The parameter gidsetsize indicates the number of entries that may be placed in gidset and is modified on return to indicate the actual number of groups returned.
RETURN VALUE
Upon success, the call returns the actual number of groups returned to array gidset. No more than NGROUPS, as defined in <sys/param.h>, will be returned.
A value of −1 indicates that an error occurred, and the error code is stored in the global variable errno.
DIAGNOSTICS
The possible errors for getgroups are:
[EINVAL] The argument gidsetsize is smaller than the number of groups in the group set.
[EFAULT] The argument gidset specifies invalid addresses.