1GETGROUPLIST(3) Library Functions Manual GETGROUPLIST(3)
2
3
4
6 getgrouplist - calculate group access list
7
9 #include <unistd.h>
10 int
11 getgrouplist(name, basegid, groups, ngroups)
12 char *name;
13 gid_t basegid;
14 gid_t *groups;
15 int *ngroups;
16
18 The getgrouplist function reads through the group file and calculates
19 the group access list for the user specified in name. The basegid is
20 automatically included in the groups list. Typically this value is
21 given as the group number from the password file.
22
23 The resulting group list is returned in the integer array pointed to by
24 groups. The caller specifies the size of the groups array in the inte‐
25 ger pointed to by ngroups; the actual number of groups found is
26 returned in ngroups.
27
29 The getgrouplist function returns -1 if the size of the group list is
30 too small to hold all the user's groups. Here, the group array will be
31 filled with as many groups as will fit.
32
34 /etc/group group membership list
35
37 setgroups(2), initgroups(3)
38
40 The getgrouplist function first appeared in 4.4BSD.
41
43 The getgrouplist function uses the routines based on getgrent(3). If
44 the invoking program uses any of these routines, the group structure
45 will be overwritten in the call to getgrouplist.
46
47
48
494th Berkeley Distribution June 25, 1997 GETGROUPLIST(3)