xref: /original-bsd/lib/libc/sys/setgroups.2 (revision e58c8952)
1.\" Copyright (c) 1983, 1991, 1993, 1994
2.\"	The Regents of the University of California.  All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)setgroups.2	8.2 (Berkeley) 04/16/94
7.\"
8.Dd
9.Dt SETGROUPS 2
10.Os BSD 4.2
11.Sh NAME
12.Nm setgroups
13.Nd set group access list
14.Sh SYNOPSIS
15.Fd #include <sys/param.h>
16.Fd #include <unistd.h>
17.Ft int
18.Fn setgroups "int ngroups" "const gid_t *gidset"
19.Sh DESCRIPTION
20.Fn Setgroups
21sets the group access list of the current user process
22according to the array
23.Fa gidset .
24The parameter
25.Fa ngroups
26indicates the number of entries in the array and must be no
27more than
28.Dv NGROUPS ,
29as defined in
30.Ao Pa sys/param.h Ac .
31.Pp
32Only the super-user may set new groups.
33.Sh RETURN VALUES
34A 0 value is returned on success, -1 on error, with
35an error code stored in
36.Va errno .
37.Sh ERRORS
38The
39.Fn setgroups
40call will fail if:
41.Bl -tag -width Er
42.It Bq Er EPERM
43The caller is not the super-user.
44.It Bq Er EFAULT
45The address specified for
46.Fa gidset
47is outside the process
48address space.
49.El
50.Sh SEE ALSO
51.Xr getgroups 2 ,
52.Xr initgroups 3
53.Sh HISTORY
54The
55.Nm
56function call appeared in
57.Bx 4.2 .
58