1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)setgroups.2 8.1 (Berkeley) 06/04/93 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 <unistd.h> 16.Fd #include <sys/param.h> 17.Ft int 18.Fn setgroups "int ngroups" "const int *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 BUGS 54The 55.Fa gidset 56array should be of type 57.Em gid_t , 58but remains integer for compatibility with earlier systems. 59.Sh HISTORY 60The 61.Nm 62function call appeared in 63.Bx 4.2 . 64