.TH setgroups() "" "" "System Call (libc)"
.PC "Set the supplemental group-access list"
.B "#include <unistd.h>"
\fBint setgroups(\fIngroups\^\fB, \fIgrouplist\^\fB)\fR
\fBint \fIngroups\^\fB; const gid_t *\fIgrouplist\^\fB;\fR
.PP
The ``supplemental group-access list''
is the list of group identifiers that are used in addition
to the effective group
identifier when determining the level of access that a process has to a file.
.B setgroups()
fills the calling process's supplemental group-access list
with the group identifiers in the array to which
.I grouplist
points.
.I ngroups
gives the number of identifiers in the array,
and cannot exceed
.BR NGROUPS_MAX .
.PP
If all goes well,
.B setgroups()
returns zero.
It fails and returns \-1 if any of the following occur:
.IP \(bu 0.3i
The value of
.I ngroups
exceeds
.BR NGROUPS_MAX .
.B setgroups
sets
.B errno
to
.BR EINVAL .
.IP \(bu
The effective user identifier is not that of the super-user
.BR root .
.B setgroups()
sets
.B errno
to
.BR EPERM .
.IP \(bu
.I grouplist
contains an illegal address.
.B setgroups()
sets
.B errno
to
.BR EFAULT .
.SH "See Also"
.Xr "getgroups()," getgroups
.Xr "initgroups()," initgroup
.Xr "libc," libc
.Xr "limits.h," limits.h
.Xr "unistd.h" unistd.h
.SH Notes
This function may be invoked only by the superuser
.BR root .
