1initgroups(3C) Standard C Library Functions initgroups(3C)
2
3
4
6 initgroups - initialize the supplementary group access list
7
9 #include <grp.h>
10 #include <sys/types.h>
11
12 int initgroups(const char *name, gid_t basegid);
13
14
16 The initgroups() function reads the group database to get the group
17 membership for the user specified by name, and initializes the supple‐
18 mentary group access list of the calling process (see getgrnam(3C) and
19 getgroups(2)). The basegid group ID is also included in the supplemen‐
20 tary group access list. This is typically the real group ID from the
21 user database.
22
23
24 While scanning the group database, if the number of groups, including
25 the basegid entry, exceeds NGROUPS_MAX, subsequent group entries are
26 ignored.
27
29 Upon successful completion, 0 is returned. Otherwise, −1 is returned
30 and errno is set to indicate the error.
31
33 The initgroups() function will fail and not change the supplementary
34 group access list if:
35
36 EPERM The {PRIV_PROC_SETID} privilege is not asserted in the effec‐
37 tive set of the calling process.
38
39
41 See attributes(5) for descriptions of the following attributes:
42
43
44
45
46 ┌─────────────────────────────┬─────────────────────────────┐
47 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
48 ├─────────────────────────────┼─────────────────────────────┤
49 │MT-Level │MT-Safe │
50 └─────────────────────────────┴─────────────────────────────┘
51
53 getgroups(2), getgrnam(3C), attributes(5)
54
55
56
57SunOS 5.11 22 Mar 2004 initgroups(3C)