GETGROUPS(2)

NAME
getgroups, setgroups - get/set groups

SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int getgroups (int len, gid_t *groups);
int setgroups (int len, const gid_t *groups);

DESCRIPTION
getgroups() and setgroups() get and set suplementary group ID's respecitvely. The parameters are len, length of the array, and groups, an array of gid_t's.

setgroups() returns 0 on success, a negative value on failure.

getgroups() returns the number of groups on success, a negative value on failure.

ERRORS
-EINVAL is returned when len is not large enough.

-EPERM is returned when a non-superuser tries to setgroups().

FILES
/usr/include/linux/sys.h
/usr/include/unistd.h

SEE ALSO
setgid(2)

BUGS
setgroups() fails silently when len > NRGROUPS, which is defined as 32 in param.h.