getgroups(2)
NAME
getgroups, setgroups - get or set supplementary group id's
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int getgroups(int gidsetlen, gid_t *gidset)
int setgroups(int gidsetlen, gid_t *gidset)
DESCRIPTION
Getgroups() fills the array gidset of length gidsetlen with the
supplementary group id's of the current process. It returns the actual
number of id's placed in the array. The return value is -1 and errno is
set to EINVAL if the array is not big enough for all the id's. One may
call getgroups with gidsetlen set to zero to query the number of
supplementary group id's currently set for the process. The value of
gidset is then not used.
Setgroups() may be used by a process with super-user privileges to set
the supplementary group id's of the process to the gidsetlen group id's
in the array gidset. Setgroups returns -1 and sets errno to EINVAL if
the number of id's is larger than the maximum reported by sysconf(2).
SEE ALSO
sysconf(2), initgroups(3).
AUTHOR
Kees J. Bot (kjb@cs.vu.nl)