Commit | Line | Data |
---|---|---|
4fa17796 KM |
1 | .\" Copyright (c) 1991 Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" %sccs.include.redist.man% | |
5 | .\" | |
6 | .\" @(#)getgrouplist.3 6.1 (Berkeley) %G% | |
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 | |
19 | The | |
20 | .Fn getgrouplist | |
21 | function reads through the group file and calculates | |
22 | the group access list for the user specified in | |
23 | .Fa name . | |
24 | The | |
25 | .Fa basegid | |
26 | is automatically included in the groups list. | |
27 | Typically this value is given as | |
28 | the group number from the password file. | |
29 | .Pp | |
30 | The resulting group list is returned in the integer array pointed to by | |
31 | .Fa groups . | |
32 | The caller specifies the size of the | |
33 | .Fa groups | |
34 | array in the integer pointed to by | |
35 | .Fa ngroups ; | |
36 | the actual number of groups found is returned in | |
37 | .Fa ngroups . | |
38 | .Sh RETURN VALUES | |
39 | The | |
40 | .Fn getgrouplist | |
41 | function | |
42 | returns \-1 if the size of the group list is too small to | |
43 | hold all the user's groups. | |
44 | Here, 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 | |
48 | group membership list | |
49 | .El | |
50 | .Sh SEE ALSO | |
51 | .Xr setgroups 2 , | |
52 | .Xr initgroups 3 | |
53 | .Sh HISTORY | |
54 | The | |
55 | .Nm | |
56 | function is | |
57 | .Ud . | |
58 | .Sh BUGS | |
59 | The | |
60 | .Fn getgrouplist | |
61 | function | |
62 | uses the routines based on | |
63 | .Xr getgrent 3 . | |
64 | If the invoking program uses any of these routines, | |
65 | the group structure will | |
66 | be overwritten in the call to | |
67 | .Fn getgrouplist . |