xref: /original-bsd/lib/libc/gen/getgrouplist.3 (revision 3705696b)
1.\" Copyright (c) 1991, 1993
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)getgrouplist.3	8.1 (Berkeley) 06/09/93
7.\"
8.Dd
9.Dt GETGROUPLIST 3
10.Os
11.Sh NAME
12.Nm getgrouplist
13.Nd calculate group access list
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft int
17.Fn getgrouplist "const char *name" "int basegid" "int *groups" "int *ngroups"
18.Sh DESCRIPTION
19The
20.Fn getgrouplist
21function reads through the group file and calculates
22the group access list for the user specified in
23.Fa name .
24The
25.Fa basegid
26is automatically included in the groups list.
27Typically this value is given as
28the group number from the password file.
29.Pp
30The resulting group list is returned in the integer array pointed to by
31.Fa groups .
32The caller specifies the size of the
33.Fa groups
34array in the integer pointed to by
35.Fa ngroups ;
36the actual number of groups found is returned in
37.Fa ngroups .
38.Sh RETURN VALUES
39The
40.Fn getgrouplist
41function
42returns \-1 if the size of the group list is too small to
43hold all the user's groups.
44Here, the group array will be filled with as many groups as will fit.
45.Sh FILES
46.Bl -tag -width /etc/group -compact
47.It Pa /etc/group
48group membership list
49.El
50.Sh SEE ALSO
51.Xr setgroups 2 ,
52.Xr initgroups 3
53.Sh HISTORY
54The
55.Fn getgrouplist
56function first appeared in 4.4BSD.
57.Sh BUGS
58The
59.Fn getgrouplist
60function
61uses the routines based on
62.Xr getgrent 3 .
63If the invoking program uses any of these routines,
64the group structure will
65be overwritten in the call to
66.Fn getgrouplist .
67