man page macro and text revisions (-mdoc version 3)
[unix-history] / usr / src / lib / libc / sys / getgroups.2
CommitLineData
931b8415 1.\" Copyright (c) 1983, 1991 The Regents of the University of California.
88b3ccf2 2.\" All rights reserved.
87e80ad5 3.\"
91cff1e1 4.\" %sccs.include.redist.man%
88b3ccf2 5.\"
931b8415 6.\" @(#)getgroups.2 6.7 (Berkeley) %G%
87e80ad5 7.\"
931b8415
CL
8.Dd
9.Dt GETGROUPS 2
10.Os BSD 4.2
11.Sh NAME
12.Nm getgroups
13.Nd get group access list
14.Sh SYNOPSIS
15.Fd #include <sys/param.h>
16.Fd #include <unistd.h>
17.Ft int
18.Fn getgroups "int gidsetlen" "int *gidset"
19.Sh DESCRIPTION
20.Fn Getgroups
87e80ad5
KM
21gets the current group access list of the user process
22and stores it in the array
931b8415 23.Fa gidset .
87e80ad5 24The parameter
931b8415 25.Fa gidsetlen
214b5721 26indicates the number of entries that may be placed in
931b8415
CL
27.Fa gidset .
28.Fn Getgroups
66f6f7d0 29returns the actual number of groups returned in
931b8415
CL
30.Fa gidset .
31No more than
32.Dv NGROUPS ,
33as defined in
34.Aq Pa sys/param.h ,
87e80ad5
KM
35will ever
36be returned.
931b8415 37.Sh RETURN VALUES
66f6f7d0 38A successful call returns the number of groups in the group set.
931b8415
CL
39A value of -1 indicates that an error occurred, and the error
40code is stored in the global variable
41.Va errno .
42.Sh ERRORS
43The possible errors for
44.Fn getgroups
45are:
46.Bl -tag -width Er
47.It Bq Er EINVAL
66f6f7d0 48The argument
931b8415 49.Fa gidsetlen
66f6f7d0 50is smaller than the number of groups in the group set.
931b8415
CL
51.It Bq Er EFAULT
52The argument
53.Fa gidset
54specifies
66f6f7d0 55an invalid address.
931b8415
CL
56.El
57.Sh SEE ALSO
58.Xr setgroups 2 ,
59.Xr initgroups 3
60.Sh BUGS
7f398d2d 61The
931b8415 62.Fa gidset
7f398d2d 63array should be of type
931b8415 64.Vt gid_t ,
7f398d2d 65but remains integer for compatibility with earlier systems.
931b8415
CL
66.Sh HISTORY
67The
68.Nm
69function call appeared in
70.Bx 4.2 .