xref: /original-bsd/lib/libc/gen/initgroups.3 (revision 403c148d)
1.\" Copyright (c) 1983, 1991 Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)initgroups.3	6.4 (Berkeley) 11/12/91
7.\"
8.Dd
9.Dt INITGROUPS 3
10.Os BSD 4.2
11.Sh NAME
12.Nm initgroups
13.Nd initialize group access list
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft int
17.Fn initgroups "const char *name" "int basegid"
18.Sh DESCRIPTION
19The
20.Fn initgroups
21function
22uses the
23.Xr getgrouplist 3
24function to calculate the group access list for the user
25specified in
26.Fa name .
27This group list is then setup for the current process using
28.Xr setgroups 2 .
29The
30.Fa basegid
31is automatically included in the groups list.
32Typically this value is given as
33the group number from the password file.
34.Sh RETURN VALUES
35The
36.Fn initgroups
37function
38returns \-1 if it was not invoked by the super-user.
39.Sh SEE ALSO
40.Xr setgroups 2 ,
41.Xr getgrouplist 3
42.Sh HISTORY
43The
44.Nm
45function appeared in
46.Bx 4.2 .
47.Sh BUGS
48The
49.Fn getgrouplist
50function called by
51.Nm
52uses the routines based on
53.Xr getgrent 3 .
54If the invoking program uses any of these routines,
55the group structure will
56be overwritten in the call to
57.Fn initgroups .
58