GETGROUPS(2) — SYSTEM CALLS
NAME
getgroups, setgroups − get or set group access list
SYNOPSIS
#include <sys/param.h>
ngroups = getgroups(gidsetlen, gidset)
int ngroups, gidsetlen, ∗gidset;
setgroups(ngroups, gidset)
int ngroups, ∗gidset;
DESCRIPTION
Getgroups
getgroups gets the current group access list of the user process and stores it in the array gidset. The parameter gidsetlen indicates the number of entries that may be placed in gidset. getgroups returns the actual number of entries placed in the gidset array. No more than NGROUPS, as defined in <sys/param.h>, will ever be returned.
Setgroups
setgroups sets the group access list of the current user process according to the array gidset. The parameter ngroups indicates the number of entries in the array and must be no more than NGROUPS, as defined in <sys/param.h>.
Only the super-user may set new groups.
RETURN VALUE
Getgroups
A return value of greater than zero indicates the number of entries placed in the gidset array. A return value of −1 indicates that an error occurred, and the error code is stored in the global variable errno.
Setgroups
A 0 value is returned on success, −1 on error, with a error code stored in errno.
ERRORS
Either call fails if:
EFAULT The address specified for gidset is outside the process address space.
getgroup fails if:
EINVAL The argument gidsetlen is smaller than the number of groups in the group set.
setgroups fails if:
EPERM The caller is not the super-user.
SEE ALSO
Sun Release 3.2 — Last change: 16 July 1986