getgroups(S) 6 January 1993 getgroups(S) Name getgroups - get supplementary group ID's Syntax cc . . . -lc #include <sys/types.h> int getgroups (gidsetsize, grouplist) int gidsetsize; gid_t *grouplist[]; Description The getgroups routine fills in the array argument grouplist with the sup- plementary group IDs of the calling process. This does not include the effective group ID of the calling process itself, unless that is one of the group IDs set by setgroups(S). The argument gidsetsize sets the max- imum number of elements in the supplied array grouplist. The actual num- ber of supplementary group IDs is returned. The values of the array entries with indices larger than or equal to the returned value are unde- fined since the array grouplist will have overflowed. As a special case, if the argument gidsetsize is zero, getgroups returns the number of supplemental group IDs associated with the calling process without modifying the array to which the argument grouplist points. Return value Upon successful completion, the getgroups routine returns the number of supplementary group IDs. This value is zero if {NGROUPSMAX} is zero. If getgroups fails, a value of -1 is returned and errno is set to indicate the error. Diagnostics If one of the following conditions occurs, getgroups returns a value of -1 and errno is set to the corresponding value: [EINVAL] The gidsetsize argument is not equal to zero and is less than the number of supplementary group IDs. See also setgroups(S) Standards conformance getgroups conforms with: X/Open Portability Guide, Issue 3, 1989; IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.