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 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: Only root can set new groups.

Returns:

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

Errors:

EFAULT
The gidset argument isn't a valid pointer.
EPERM
The caller isn't root.

Classification:

Unix

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

See also:

getgroups(), initgroups()