Go to the previous, next section.

getgroups and setgroups

SYNOPSIS

int getgroups(int size, gid_t list[]);

int setgroups(size_t size, const gid_t *list);

PARAMETERS

size: [in] the maximum size of list.

list: (For getgroups) [out] the array where to put the groups returned. (For setgroups) [in] the new supplemental groups.

DESCRIPTION

getgroups: up to size supplemental group entries of the current task are returned in list. If size is zero, no groups but instead the total number of supplemental groups is returned.

setgroups: sets the supplemental groups for the current task. Only the superuser may call this function.

RETURN VALUE

On success, for getgroups, the number of groups returned in list is returned. If size is zero, then the number of supplemental groups is returned. In the case of setgroups, zero is returned on success.

On error, -1 is returned and errno is set to one of the following values:

For both calls: EFAULT.

For setgroups:

Go to the previous, next section.