add getvfsbyname
[unix-history] / usr / src / lib / libc / gen / initgroups.3
CommitLineData
74155b62
KB
1.\" Copyright (c) 1983, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
22e59cfd 3.\"
ae59e04c 4.\" %sccs.include.redist.man%
22e59cfd 5.\"
74155b62 6.\" @(#)initgroups.3 8.1 (Berkeley) %G%
ae59e04c
CL
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
11b3b4d6
KM
22uses the
23.Xr getgrouplist 3
24function to calculate the group access list for the user
22e59cfd 25specified in
ae59e04c 26.Fa name .
11b3b4d6
KM
27This group list is then setup for the current process using
28.Xr setgroups 2 .
22e59cfd 29The
ae59e04c 30.Fa basegid
22e59cfd
KM
31is automatically included in the groups list.
32Typically this value is given as
33the group number from the password file.
ae59e04c
CL
34.Sh RETURN VALUES
35The
36.Fn initgroups
37function
22e59cfd 38returns \-1 if it was not invoked by the super-user.
ae59e04c
CL
39.Sh SEE ALSO
40.Xr setgroups 2 ,
11b3b4d6 41.Xr getgrouplist 3
ae59e04c
CL
42.Sh HISTORY
43The
44.Nm
45function appeared in
46.Bx 4.2 .
47.Sh BUGS
48The
11b3b4d6
KM
49.Fn getgrouplist
50function called by
51.Nm
22e59cfd 52uses the routines based on
ae59e04c 53.Xr getgrent 3 .
22e59cfd
KM
54If the invoking program uses any of these routines,
55the group structure will
56be overwritten in the call to
ae59e04c 57.Fn initgroups .