setgroups()

QNX SDP8.0C Library ReferenceAPIDeveloper

Set supplementary group IDs

Synopsis:

#include <unistd.h>

int setgroups( int gidsetsize,
               const gid_t *grouplist );

Arguments:

gidsetsize
The number of entries in the grouplist array. This number can't exceed sysconf(_SC_NGROUPS_MAX).
grouplist
An array of the supplementary group IDs that you want to assign to the calling process.

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 calling process to the array of group IDs in grouplist.

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().
QNX recommends that you do not use a negative value for a group ID.

Returns:

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

Errors:

EFAULT
The grouplist argument isn't a valid pointer.
EINVAL
The value of gidsetsize is larger than sysconf(_SC_NGROUPS_MAX).
EPERM
The calling process doesn't have the required permission; see procmgr_ability().

Classification:

Unix

Safety:
Cancellation pointNo
Signal handlerNo
ThreadYes
Page updated: