GETGROUPS(S) UNIX System V GETGROUPS(S)
Name
getgroups - get supplementary group ID's
Syntax
#include <sys/types.h>
int getgroups(gidsetsize, gidset)
int gidsetsize;
gid_t gidset;
Description
The getgroups() function fills in the array grouplist with
the supplementary group IDs of the calling process. The
gidsetsize argument specifies the number of elements in the
supplied array grouplist . The actual number of
supplementary group IDs is returned. The values of the
array entries with indices larger than or equal to the
returned value are undefined.
The effective group ID of the calling process is omitted
from the returned list of supplementary group IDs.
As a special case, if the gidsetsize argument is zero,
getgroups() returns the number of supplemental group IDs
associated with the calling process without modifying the
array pointed to by the grouplist argument.
Return Value
Upon successful completion, the number of supplementary
group IDs is returned. This value is zero if {NGROUPS_MAX}
is zero. A return value of -1 indicates failure and errno
is set to indicate the error.
Diagnostics
If any of the following conditions occur, the getgroups()
function returns -1 and sets errno to the corresponding
value:
[EINVAL] The gidsetsize argument is not equal to
zero and is less than the number of
supplementary group IDs.
[EFAULT] The grouplist argument is a bad pointer
into the calling process address space.
See Also
setgroups(S)
Standards Conformance
getgroups is conformant with:
IEEE POSIX Std 1003.1-1988 with C Standard Language-
Dependent System Support;
and NIST FIPS 151-1.
(printed 6/20/89)