getgroups(2)
NAME
getgroups − get group access list
SYNTAX
#include <sys/param.h>
#include <sys/types.h>
int
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>, are returned.
A value of −1 indicates that an error occurred, and the error code is stored in the global variable errno.
ENVIRONMENT
POSIX
When your program is compiled in POSIX mode the gidset argument should be defined as follows: gid_tgidset[ ];
Additionally, in the POSIX mode environment, if the gidsetsize argument is zero, getgroups returns the number of supplemental group IDs associated with t he calling process without modifying the array pointed to by the gidset argument.
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.
SEE ALSO
System Calls