update from Donn -- fixes for pcc
[unix-history] / usr / src / lib / libc / sys / getgroups.2
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)getgroups.2 6.7 (Berkeley) %G%
.\"
.Dd
.Dt GETGROUPS 2
.Os BSD 4.2
.Sh NAME
.Nm getgroups
.Nd get group access list
.Sh SYNOPSIS
.Fd #include <sys/param.h>
.Fd #include <unistd.h>
.Ft int
.Fn getgroups "int gidsetlen" "int *gidset"
.Sh DESCRIPTION
.Fn Getgroups
gets the current group access list of the user process
and stores it in the array
.Fa gidset .
The parameter
.Fa gidsetlen
indicates the number of entries that may be placed in
.Fa gidset .
.Fn Getgroups
returns the actual number of groups returned in
.Fa gidset .
No more than
.Dv NGROUPS ,
as defined in
.Aq Pa sys/param.h ,
will ever
be returned.
.Sh RETURN VALUES
A successful call returns the number of groups in the group set.
A value of -1 indicates that an error occurred, and the error
code is stored in the global variable
.Va errno .
.Sh ERRORS
The possible errors for
.Fn getgroups
are:
.Bl -tag -width Er
.It Bq Er EINVAL
The argument
.Fa gidsetlen
is smaller than the number of groups in the group set.
.It Bq Er EFAULT
The argument
.Fa gidset
specifies
an invalid address.
.El
.Sh SEE ALSO
.Xr setgroups 2 ,
.Xr initgroups 3
.Sh BUGS
The
.Fa gidset
array should be of type
.Vt gid_t ,
but remains integer for compatibility with earlier systems.
.Sh HISTORY
The
.Nm
function call appeared in
.Bx 4.2 .