1*47208Scael.\" Copyright (c) 1983, 1991 The Regents of the University of California. 238053Sbostic.\" All rights reserved. 320259Smckusick.\" 443568Strent.\" %sccs.include.redist.man% 520259Smckusick.\" 6*47208Scael.\" @(#)setgroups.2 6.7 (Berkeley) 03/10/91 738053Sbostic.\" 8*47208Scael.Dd 9*47208Scael.Dt SETGROUPS 2 10*47208Scael.Os BSD 4.2 11*47208Scael.Sh NAME 12*47208Scael.Nm setgroups 13*47208Scael.Nd set group access list 14*47208Scael.Sh SYNOPSIS 15*47208Scael.Fd #include <unistd.h> 16*47208Scael.Fd #include <sys/param.h> 17*47208Scael.Ft int 18*47208Scael.Fn setgroups "int ngroups" "const int *gidset" 19*47208Scael.Sh DESCRIPTION 20*47208Scael.Fn Setgroups 2120259Smckusicksets the group access list of the current user process 2220259Smckusickaccording to the array 23*47208Scael.Fa gidset . 2420259SmckusickThe parameter 25*47208Scael.Fa ngroups 2620259Smckusickindicates the number of entries in the array and must be no 27*47208Scaelmore than 28*47208Scael.Dv NGROUPS , 29*47208Scaelas defined in 30*47208Scael.Ao Pa sys/param.h Ac . 31*47208Scael.Pp 3220259SmckusickOnly the super-user may set new groups. 33*47208Scael.Sh RETURN VALUES 34*47208ScaelA 0 value is returned on success, -1 on error, with 35*47208Scaelan error code stored in 36*47208Scael.Va errno . 37*47208Scael.Sh ERRORS 38*47208ScaelThe 39*47208Scael.Fn setgroups 40*47208Scaelcall will fail if: 41*47208Scael.Bl -tag -width Er 42*47208Scael.It Bq Er EPERM 4320259SmckusickThe caller is not the super-user. 44*47208Scael.It Bq Er EFAULT 45*47208ScaelThe address specified for 46*47208Scael.Fa gidset 47*47208Scaelis outside the process 4820259Smckusickaddress space. 49*47208Scael.El 50*47208Scael.Sh SEE ALSO 51*47208Scael.Xr getgroups 2 , 52*47208Scael.Xr initgroups 3 53*47208Scael.Sh BUGS 5428076SkarelsThe 55*47208Scael.Fa gidset 5628076Skarelsarray should be of type 57*47208Scael.Em gid_t , 5828076Skarelsbut remains integer for compatibility with earlier systems. 59*47208Scael.Sh HISTORY 60*47208ScaelThe 61*47208Scael.Nm 62*47208Scaelfunction call appeared in 63*47208Scael.Bx 4.2 . 64