1*62883Sbostic.\" Copyright (c) 1991, 1993 2*62883Sbostic.\" The Regents of the University of California. All rights reserved. 351663Smckusick.\" 451663Smckusick.\" %sccs.include.redist.man% 551663Smckusick.\" 6*62883Sbostic.\" @(#)getgrouplist.3 8.1 (Berkeley) 06/09/93 751663Smckusick.\" 851663Smckusick.Dd 951663Smckusick.Dt GETGROUPLIST 3 1051663Smckusick.Os 1151663Smckusick.Sh NAME 1251663Smckusick.Nm getgrouplist 1351663Smckusick.Nd calculate group access list 1451663Smckusick.Sh SYNOPSIS 1551663Smckusick.Fd #include <unistd.h> 1651663Smckusick.Ft int 1751663Smckusick.Fn getgrouplist "const char *name" "int basegid" "int *groups" "int *ngroups" 1851663Smckusick.Sh DESCRIPTION 1951663SmckusickThe 2051663Smckusick.Fn getgrouplist 2151663Smckusickfunction reads through the group file and calculates 2251663Smckusickthe group access list for the user specified in 2351663Smckusick.Fa name . 2451663SmckusickThe 2551663Smckusick.Fa basegid 2651663Smckusickis automatically included in the groups list. 2751663SmckusickTypically this value is given as 2851663Smckusickthe group number from the password file. 2951663Smckusick.Pp 3051663SmckusickThe resulting group list is returned in the integer array pointed to by 3151663Smckusick.Fa groups . 3251663SmckusickThe caller specifies the size of the 3351663Smckusick.Fa groups 3451663Smckusickarray in the integer pointed to by 3551663Smckusick.Fa ngroups ; 3651663Smckusickthe actual number of groups found is returned in 3751663Smckusick.Fa ngroups . 3851663Smckusick.Sh RETURN VALUES 3951663SmckusickThe 4051663Smckusick.Fn getgrouplist 4151663Smckusickfunction 4251663Smckusickreturns \-1 if the size of the group list is too small to 4351663Smckusickhold all the user's groups. 4451663SmckusickHere, the group array will be filled with as many groups as will fit. 4551663Smckusick.Sh FILES 4651663Smckusick.Bl -tag -width /etc/group -compact 4751663Smckusick.It Pa /etc/group 4851663Smckusickgroup membership list 4951663Smckusick.El 5051663Smckusick.Sh SEE ALSO 5151663Smckusick.Xr setgroups 2 , 5251663Smckusick.Xr initgroups 3 5351663Smckusick.Sh HISTORY 5451663SmckusickThe 5562882Sbostic.Fn getgrouplist 5662882Sbosticfunction first appeared in 4.4BSD. 5751663Smckusick.Sh BUGS 5851663SmckusickThe 5951663Smckusick.Fn getgrouplist 6051663Smckusickfunction 6151663Smckusickuses the routines based on 6251663Smckusick.Xr getgrent 3 . 6351663SmckusickIf the invoking program uses any of these routines, 6451663Smckusickthe group structure will 6551663Smckusickbe overwritten in the call to 6651663Smckusick.Fn getgrouplist . 67