1*51663Smckusick.\" Copyright (c) 1991 Regents of the University of California. 2*51663Smckusick.\" All rights reserved. 3*51663Smckusick.\" 4*51663Smckusick.\" %sccs.include.redist.man% 5*51663Smckusick.\" 6*51663Smckusick.\" @(#)getgrouplist.3 6.1 (Berkeley) 11/12/91 7*51663Smckusick.\" 8*51663Smckusick.Dd 9*51663Smckusick.Dt GETGROUPLIST 3 10*51663Smckusick.Os 11*51663Smckusick.Sh NAME 12*51663Smckusick.Nm getgrouplist 13*51663Smckusick.Nd calculate group access list 14*51663Smckusick.Sh SYNOPSIS 15*51663Smckusick.Fd #include <unistd.h> 16*51663Smckusick.Ft int 17*51663Smckusick.Fn getgrouplist "const char *name" "int basegid" "int *groups" "int *ngroups" 18*51663Smckusick.Sh DESCRIPTION 19*51663SmckusickThe 20*51663Smckusick.Fn getgrouplist 21*51663Smckusickfunction reads through the group file and calculates 22*51663Smckusickthe group access list for the user specified in 23*51663Smckusick.Fa name . 24*51663SmckusickThe 25*51663Smckusick.Fa basegid 26*51663Smckusickis automatically included in the groups list. 27*51663SmckusickTypically this value is given as 28*51663Smckusickthe group number from the password file. 29*51663Smckusick.Pp 30*51663SmckusickThe resulting group list is returned in the integer array pointed to by 31*51663Smckusick.Fa groups . 32*51663SmckusickThe caller specifies the size of the 33*51663Smckusick.Fa groups 34*51663Smckusickarray in the integer pointed to by 35*51663Smckusick.Fa ngroups ; 36*51663Smckusickthe actual number of groups found is returned in 37*51663Smckusick.Fa ngroups . 38*51663Smckusick.Sh RETURN VALUES 39*51663SmckusickThe 40*51663Smckusick.Fn getgrouplist 41*51663Smckusickfunction 42*51663Smckusickreturns \-1 if the size of the group list is too small to 43*51663Smckusickhold all the user's groups. 44*51663SmckusickHere, the group array will be filled with as many groups as will fit. 45*51663Smckusick.Sh FILES 46*51663Smckusick.Bl -tag -width /etc/group -compact 47*51663Smckusick.It Pa /etc/group 48*51663Smckusickgroup membership list 49*51663Smckusick.El 50*51663Smckusick.Sh SEE ALSO 51*51663Smckusick.Xr setgroups 2 , 52*51663Smckusick.Xr initgroups 3 53*51663Smckusick.Sh HISTORY 54*51663SmckusickThe 55*51663Smckusick.Nm 56*51663Smckusickfunction is 57*51663Smckusick.Ud . 58*51663Smckusick.Sh BUGS 59*51663SmckusickThe 60*51663Smckusick.Fn getgrouplist 61*51663Smckusickfunction 62*51663Smckusickuses the routines based on 63*51663Smckusick.Xr getgrent 3 . 64*51663SmckusickIf the invoking program uses any of these routines, 65*51663Smckusickthe group structure will 66*51663Smckusickbe overwritten in the call to 67*51663Smckusick.Fn getgrouplist . 68