Go to the previous, next section.
int getgroups(int size, gid_t list[]);
int setgroups(size_t size, const gid_t *list);
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.
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.
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:
EPERM: the current taks does not have superuser permission.
EINVAL: size is greater than the maximum possible number of
supplemental groups.
Go to the previous, next section.