getgroups
extern int getgroups(int groupCount, gid_t groupList[]);
int count = getgroups(0, NULL);
int len = getgroups(count, groups);
nGroups = getgroups(ngroups_max, groups);
int groupCount = getgroups(NGROUPS_MAX, groups);