.\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" %sccs.include.redist.man% .\" .\" @(#)getgroups.2 8.1 (Berkeley) 06/04/93 .\" .Dd .Dt GETGROUPS 2 .Os BSD 4.2 .Sh NAME .Nm getgroups .Nd get group access list .Sh SYNOPSIS .Fd #include .Fd #include .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 .