xref: /csrg-svn/lib/libc/sys/getgroups.2 (revision 47208)
1*47208Scael.\" Copyright (c) 1983, 1991 The Regents of the University of California.
238053Sbostic.\" All rights reserved.
320223Smckusick.\"
443568Strent.\" %sccs.include.redist.man%
520223Smckusick.\"
6*47208Scael.\"     @(#)getgroups.2	6.7 (Berkeley) 03/10/91
738053Sbostic.\"
8*47208Scael.Dd
9*47208Scael.Dt GETGROUPS 2
10*47208Scael.Os BSD 4.2
11*47208Scael.Sh NAME
12*47208Scael.Nm getgroups
13*47208Scael.Nd get group access list
14*47208Scael.Sh SYNOPSIS
15*47208Scael.Fd #include <sys/param.h>
16*47208Scael.Fd #include <unistd.h>
17*47208Scael.Ft int
18*47208Scael.Fn getgroups "int gidsetlen" "int *gidset"
19*47208Scael.Sh DESCRIPTION
20*47208Scael.Fn Getgroups
2120223Smckusickgets the current group access list of the user process
2220223Smckusickand stores it in the array
23*47208Scael.Fa gidset .
2420223SmckusickThe parameter
25*47208Scael.Fa gidsetlen
2623803Ssechrestindicates the number of entries that may be placed in
27*47208Scael.Fa gidset .
28*47208Scael.Fn Getgroups
2920224Smckusickreturns the actual number of groups returned in
30*47208Scael.Fa gidset .
31*47208ScaelNo more than
32*47208Scael.Dv NGROUPS ,
33*47208Scaelas defined in
34*47208Scael.Aq Pa sys/param.h ,
3520223Smckusickwill ever
3620223Smckusickbe returned.
37*47208Scael.Sh RETURN VALUES
3820224SmckusickA successful call returns the number of groups in the group set.
39*47208ScaelA value of -1 indicates that an error occurred, and the error
40*47208Scaelcode is stored in the global variable
41*47208Scael.Va errno .
42*47208Scael.Sh ERRORS
43*47208ScaelThe possible errors for
44*47208Scael.Fn getgroups
45*47208Scaelare:
46*47208Scael.Bl -tag -width Er
47*47208Scael.It Bq Er EINVAL
4820224SmckusickThe argument
49*47208Scael.Fa gidsetlen
5020224Smckusickis smaller than the number of groups in the group set.
51*47208Scael.It Bq Er EFAULT
52*47208ScaelThe argument
53*47208Scael.Fa gidset
54*47208Scaelspecifies
5520224Smckusickan invalid address.
56*47208Scael.El
57*47208Scael.Sh SEE ALSO
58*47208Scael.Xr setgroups 2 ,
59*47208Scael.Xr initgroups 3
60*47208Scael.Sh BUGS
6128076SkarelsThe
62*47208Scael.Fa gidset
6328076Skarelsarray should be of type
64*47208Scael.Vt gid_t ,
6528076Skarelsbut remains integer for compatibility with earlier systems.
66*47208Scael.Sh HISTORY
67*47208ScaelThe
68*47208Scael.Nm
69*47208Scaelfunction call appeared in
70*47208Scael.Bx 4.2 .
71