setgroups()

Set supplementary group IDs

Synopsis:

#include <unistd.h>

int setgroups( int ngroups,
               const gid_t *gidset );

Arguments:

ngroups
The number of entries in the gidset array.
gidset
An array of the supplementary group IDs that you want to assign to the current user. This number of entries in this array can't exceed sysconf(_SC_NGROUPS_MAX).

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The setgroups() function sets the group access list of the current user to the array of group IDs in gidset.

Note: In order to set new groups or delete existing groups, your process must have the PROCMGR_AID_SETGID ability enabled. For more information, see procmgr_ability().

Returns:

0, or -1 if an error occurred (errno is set).

Errors:

EFAULT
The gidset argument isn't a valid pointer.
EPERM
The calling process doesn't have the required permission; see procmgr_ability().

Classification:

Unix

Safety:  
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread No