xref: /original-bsd/lib/libc/sys/getgroups.2 (revision e58c8952)
1.\" Copyright (c) 1983, 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)getgroups.2	8.2 (Berkeley) 04/16/94
7.\"
8.Dd
9.Dt GETGROUPS 2
10.Os BSD 4.2
11.Sh NAME
12.Nm getgroups
13.Nd get group access list
14.Sh SYNOPSIS
15.Fd #include <sys/param.h>
16.Fd #include <unistd.h>
17.Ft int
18.Fn getgroups "int gidsetlen" "gid_t *gidset"
19.Sh DESCRIPTION
20.Fn Getgroups
21gets the current group access list of the user process
22and stores it in the array
23.Fa gidset .
24The parameter
25.Fa gidsetlen
26indicates the number of entries that may be placed in
27.Fa gidset .
28.Fn Getgroups
29returns the actual number of groups returned in
30.Fa gidset .
31No more than
32.Dv NGROUPS ,
33as defined in
34.Aq Pa sys/param.h ,
35will ever
36be returned.
37.Sh RETURN VALUES
38A successful call returns the number of groups in the group set.
39A value of -1 indicates that an error occurred, and the error
40code is stored in the global variable
41.Va errno .
42.Sh ERRORS
43The possible errors for
44.Fn getgroups
45are:
46.Bl -tag -width Er
47.It Bq Er EINVAL
48The argument
49.Fa gidsetlen
50is smaller than the number of groups in the group set.
51.It Bq Er EFAULT
52The argument
53.Fa gidset
54specifies
55an invalid address.
56.El
57.Sh SEE ALSO
58.Xr setgroups 2 ,
59.Xr initgroups 3
60.Sh HISTORY
61The
62.Nm
63function call appeared in
64.Bx 4.2 .
65