getgroups(2P) INTERACTIVE UNIX System (POSIX) getgroups(2P)
NAME
getgroups - get supplementary group IDs
SYNOPSIS
#include <sys/types.h>
int getgroups (gidsetsize,grouplist)
int gidsetsize;
gid_t grouplist [];
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 supplemen-
tary group IDs is returned. The values of array entries
with indices larger than or equal to the returned value are
undefined.
It is not specified whether the effective group ID of the
calling process is included in or omitted from the returned
list of supplementary group IDs.
As a special case, if the gidsetsize argument is zero, get-
groups() returns the number of supplemental group IDs asso-
ciated with the calling process without modifying the array
pointed to by the grouplist argument.
RETURN VALUES
Upon successful completion, the number of supplementary
group IDs is returned. A return value of -1 indicates
failure, and errno is set to indicate the error.
ERROR MESSAGES
If any of the following conditions occur, the getgroups()
function will return -1 and set errno to the corresponding
value:
[EINVAL]
The gidsetsize argument is not equal to zero and is
less than the number of supplementary group IDs.
Rev. 1.1 Page 1