#include <sys/types.h> #include <grp.h> int setgroups(int listSize, const gid_t groupList[]);
setgroups
sets the supplementary group ID list for the
calling process to the list provided by the groupList
argument.
listSize
specifies the size of the groupList
array.
The size of groupList
cannot exceed the NGROUPS_MAX
value, which is defined in <grp.h>
. The sysconf
function can be used to determine the value of NGROUPS_MAX
.
Note: This function can only be called by a superuser.
setgroups
returns a 0
if successful and a -1
if unsuccessful.
getgroups
, initgroups
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.