xref: /csrg-svn/lib/libc/gen/initgroups.3 (revision 51664)
148352Scael.\" Copyright (c) 1983, 1991 Regents of the University of California.
248352Scael.\" All rights reserved.
320542Smckusick.\"
448352Scael.\" %sccs.include.redist.man%
520542Smckusick.\"
6*51664Smckusick.\"     @(#)initgroups.3	6.4 (Berkeley) 11/12/91
748352Scael.\"
848352Scael.Dd
948352Scael.Dt INITGROUPS 3
1048352Scael.Os BSD 4.2
1148352Scael.Sh NAME
1248352Scael.Nm initgroups
1348352Scael.Nd initialize group access list
1448352Scael.Sh SYNOPSIS
1548352Scael.Fd #include <unistd.h>
1648352Scael.Ft int
1748352Scael.Fn initgroups "const char *name" "int basegid"
1848352Scael.Sh DESCRIPTION
1948352ScaelThe
2048352Scael.Fn initgroups
2148352Scaelfunction
22*51664Smckusickuses the
23*51664Smckusick.Xr getgrouplist 3
24*51664Smckusickfunction to calculate the group access list for the user
2520542Smckusickspecified in
2648352Scael.Fa name .
27*51664SmckusickThis group list is then setup for the current process using
28*51664Smckusick.Xr setgroups 2 .
2920542SmckusickThe
3048352Scael.Fa basegid
3120542Smckusickis automatically included in the groups list.
3220542SmckusickTypically this value is given as
3320542Smckusickthe group number from the password file.
3448352Scael.Sh RETURN VALUES
3548352ScaelThe
3648352Scael.Fn initgroups
3748352Scaelfunction
3820542Smckusickreturns \-1 if it was not invoked by the super-user.
3948352Scael.Sh SEE ALSO
4048352Scael.Xr setgroups 2 ,
41*51664Smckusick.Xr getgrouplist 3
4248352Scael.Sh HISTORY
4348352ScaelThe
4448352Scael.Nm
4548352Scaelfunction appeared in
4648352Scael.Bx 4.2 .
4748352Scael.Sh BUGS
4848352ScaelThe
49*51664Smckusick.Fn getgrouplist
50*51664Smckusickfunction called by
51*51664Smckusick.Nm
5220542Smckusickuses the routines based on
5348352Scael.Xr getgrent 3 .
5420542SmckusickIf the invoking program uses any of these routines,
5520542Smckusickthe group structure will
5620542Smckusickbe overwritten in the call to
5748352Scael.Fn initgroups .
58